[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] New XFail test for the issue 3781

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Fri, 4 Feb 2011 04:42:32 +0200

Prabhu Gnana Sundar wrote on Thu, Feb 03, 2011 at 16:53:54 +0530:
> Hi all,
>
> Currently, as per the issue 3781, "checkout" reads the authz file in
> *case insensitive* way, whereas "commit" reads the authz file in *case
> sensitive* way.
>
> Here is what is observed:
> 1. Checkout is *case insensitive* about the repository name section and
> also the path-inside-repo section.
> 2. Commit is *case sensitive* about the repository name section *but
> case insensitive* about the path-inside-repo section.
>
> Attached an XFail testcase and the log message with this mail. Please
> share your views.
>
>

You didn't actually say what the intended behaviour is.

> [[[
> XFail testcase for the issue 3781

Thanks for writing the XFail test first.

> Index: subversion/tests/cmdline/authz_tests.py
> ===================================================================
> --- subversion/tests/cmdline/authz_tests.py (revision 1066732)
> +++ subversion/tests/cmdline/authz_tests.py (working copy)
> @@ -1061,6 +1061,67 @@
> [], 'ls', '-R',
> sbox.repo_url)
>
> +
> +def case_insensitive_authz(sbox):
> + "authz issue #3781, check case insensitiveness"
> +
> + sbox.build()
> +
> + # test the case-insensitivity of the path inside the repo
> + write_authz_file(sbox, {"/": "jrandom = r", "/A": "jrandom = r", "/a/Mu": "jrandom = rw"})
> +
> + write_restrictive_svnserve_conf(sbox.repo_dir)
> +
> + wc_dir = sbox.wc_dir
> +
> + mu_path = os.path.join(wc_dir, 'A', 'mu')
> + mu_url = sbox.repo_url + '/A/mu'
> + svntest.main.file_append(mu_path, "hi")
> +
> + # Create expected output tree.
> + expected_output = svntest.wc.State(wc_dir, {
> + 'A/mu' : Item(verb='Sending'),
> + })
> +
> + # Commit the file.
> + svntest.actions.run_and_verify_commit(wc_dir,
> + expected_output,
> + None,
> + None,
> + mu_path)

Hold on. Why does this work? You commit /A/mu and the authz file gives
you only 'r' access to /A!

> + svntest.actions.run_and_verify_svn2('No error',
> + svntest.verify.AnyOutput, [],
> + 0, 'cat', mu_url)
> +
> + def mixcases(repo_name):
> + mixed_repo_name = ''
> + for i in range(0, len(repo_name)):
> + if i % 2 == 0:
> + mixed_val = repo_name[i].upper()
> + mixed_repo_name = mixed_repo_name + mixed_val
> + else:
> + mixed_val = repo_name[i].lower()
> + mixed_repo_name = mixed_repo_name + mixed_val
> + return mixed_repo_name
> +

Nice, but why not just pass NAME to sbox.build() and then hard-code
'bar' and 'baR' in the test?

> + mixed_case_repo_dir = mixcases(os.path.basename(sbox.repo_dir))
> +
> + # test the case-insensitivity of the repo name
> + write_authz_file(sbox, {}, sections = {mixed_case_repo_dir + ":/": "jrandom = r",
> + mixed_case_repo_dir + ":/A": "jrandom = r",
> + mixed_case_repo_dir + ":/A/mu": "jrandom = rw"})
> +

Just for clarity, could you add sections for the correct-case repository
name to the authz file?

> + svntest.main.file_append(mu_path, "hi")
> + # Commit the file again.
> + svntest.actions.run_and_verify_commit(wc_dir,
> + expected_output,
> + None,
> + None,
> + mu_path)
> + svntest.actions.run_and_verify_svn2('No error',
> + svntest.verify.AnyOutput, [],
> + 0, 'cat', mu_url)

Could you have here both a commit that fails and a commit that succeeds?
Received on 2011-02-04 03:47:16 CET

This is an archived mail posted to the Subversion Dev mailing list.