You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ka...@apache.org on 2011/02/08 15:25:06 UTC

svn commit: r1068411 - /subversion/trunk/subversion/tests/cmdline/authz_tests.py

Author: kameshj
Date: Tue Feb  8 14:25:05 2011
New Revision: 1068411

URL: http://svn.apache.org/viewvc?rev=1068411&view=rev
Log:
XFail testcase for the issue 3781

* subversion/tests/cmdline/authz_tests.py
  (case_sensitive_authz): New XFail test for the issue 3781
  (test_list): Add case_sensitive_authz.

Patch by: Prabhu Gnana Sundar <prabhugs{_AT_}collab.net>
Tweaked by: kameshj

Modified:
    subversion/trunk/subversion/tests/cmdline/authz_tests.py

Modified: subversion/trunk/subversion/tests/cmdline/authz_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/authz_tests.py?rev=1068411&r1=1068410&r2=1068411&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/authz_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/authz_tests.py Tue Feb  8 14:25:05 2011
@@ -1084,6 +1084,101 @@ def authz_recursive_ls(sbox):
                                      [], 'ls', '-R',
                                      sbox.repo_url)
 
+@XFail()
+@Issue(3781)
+@Skip(svntest.main.is_ra_type_file)
+def case_sensitive_authz(sbox):
+  "authz issue #3781, check case sensitiveness"
+
+  sbox.build()
+
+  wc_dir = sbox.wc_dir
+  write_restrictive_svnserve_conf(sbox.repo_dir)
+
+  mu_path = os.path.join(wc_dir, 'A', 'mu')
+  mu_url = sbox.repo_url + '/A/mu'
+  mu_repo_path = sbox.repo_dir + "/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'),
+    })
+
+  # error messages
+  expected_error_for_commit = "Commit failed"
+  expected_error_for_cat = "svn: E175013: Unable to connect to a repository"+ \
+                            " at URL '" + mu_url + "'\n" + \
+                            "svn: E175013: Access to '/" + mu_repo_path + \
+                            "' forbidden\n" + \
+                            "svn: E175009: XML parsing failed: (403 Forbidden)"
+
+  # test the case-sensitivity of the path inside the repo
+  write_authz_file(sbox, {"/": "jrandom = r",
+                          "/A/mu": "jrandom =", "/a/Mu": "jrandom = rw"})
+  svntest.actions.run_and_verify_svn2(None, None,
+                                      expected_error_for_cat,
+                                      1, 'cat', mu_url)
+
+  write_authz_file(sbox, {"/": "jrandom = r",
+                          "/A": "jrandom = r",
+                          "/a/Mu": "jrandom = rw"})
+  # Commit the file.
+  svntest.actions.run_and_verify_commit(wc_dir,
+                                        None,
+                                        None,
+                                        expected_error_for_commit,
+                                        mu_path)
+
+  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 
+
+  mixed_case_repo_dir = mixcases(os.path.basename(sbox.repo_dir))
+
+  # test the case-sensitivity of the repo name
+  sec_mixed_case = {mixed_case_repo_dir + ":/": "jrandom = r",
+                    mixed_case_repo_dir + ":/A": "jrandom = r",
+                    os.path.basename(sbox.repo_dir) + ":/A/mu": "jrandom =",
+                    mixed_case_repo_dir + ":/A/mu": "jrandom = rw"}
+  write_authz_file(sbox, {}, sec_mixed_case)
+  svntest.actions.run_and_verify_svn2(None, None,
+                                      expected_error_for_cat,
+                                      1, 'cat', mu_url)
+
+  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"})
+
+  # Commit the file again.
+  svntest.actions.run_and_verify_commit(wc_dir,
+                                        None,
+                                        None,
+                                        expected_error_for_commit,
+                                        mu_path)
+
+  # test the case-sensitivity
+  write_authz_file(sbox, {"/": "jrandom = r",
+                          "/A": "jrandom = r", "/A/mu": "jrandom = rw"})
+
+  svntest.actions.run_and_verify_svn2('No error',
+                                      svntest.verify.AnyOutput, [],
+                                      0, 'cat', mu_url)
+  # Commit the file.
+  svntest.actions.run_and_verify_commit(wc_dir,
+                                        expected_output,
+                                        None,
+                                        None,
+                                        mu_path)
+
 ########################################################################
 # Run the tests
 
@@ -1108,6 +1203,7 @@ test_list = [ None,
               multiple_matches,
               wc_wc_copy_revert,
               authz_recursive_ls,
+              case_sensitive_authz,
              ]
 serial_only = True
 



RE: svn commit: r1068411 - /subversion/trunk/subversion/tests/cmdline/authz_tests.py

Posted by Kamesh Jayachandran <ka...@collab.net>.
>> >>Bad idea to hard code so much of the specific message we're generating
>> >>today; it's bound to change later.
>> >
>> >>(eg, the XML parsing thing would ideally go away at some point)
>> >
>> >>Just 'Access.*${mu_url}.*forbidden' is enough IMO.
>> >
>> >
>> > Thanks We fixed this in r1068802 Still we have "E170001:" for svnserve would
>> > remove it as soon as I reach before my working copy.

>Thanks.  But why remove the E170001?  Its very purpose is to provide
>a machine-readable identification of the error... (exactly what tests
>need)


In r1068802 We did the following,

-  expected_error_for_cat = "svn: E175013: Unable to connect to a repository"+ \
-                            " at URL '" + mu_url + "'\n" + \
-                            "svn: E175013: Access to '/" + mu_repo_path + \
-                            "' forbidden\n" + \
-                            "svn: E175009: XML parsing failed: (403 Forbidden)"
 
+  if sbox.repo_url.startswith("http"):
+    expected_error_for_cat = ".*[Ff]orbidden.*"
+  else:
+    expected_error_for_cat = ".*svn: E170001: Authorization failed.*"
+

Do you mean to reinstate errorcodes(E175013, E175013, E175009) check ?

With regards
Kamesh Jayachandran

RE: svn commit: r1068411 - /subversion/trunk/subversion/tests/cmdline/authz_tests.py

Posted by Kamesh Jayachandran <ka...@collab.net>.
>> >>Bad idea to hard code so much of the specific message we're generating
>> >>today; it's bound to change later.
>> >
>> >>(eg, the XML parsing thing would ideally go away at some point)
>> >
>> >>Just 'Access.*${mu_url}.*forbidden' is enough IMO.
>> >
>> >
>> > Thanks We fixed this in r1068802 Still we have "E170001:" for svnserve would
>> > remove it as soon as I reach before my working copy.

>Thanks.  But why remove the E170001?  Its very purpose is to provide
>a machine-readable identification of the error... (exactly what tests
>need)


In r1068802 We did the following,

-  expected_error_for_cat = "svn: E175013: Unable to connect to a repository"+ \
-                            " at URL '" + mu_url + "'\n" + \
-                            "svn: E175013: Access to '/" + mu_repo_path + \
-                            "' forbidden\n" + \
-                            "svn: E175009: XML parsing failed: (403 Forbidden)"
 
+  if sbox.repo_url.startswith("http"):
+    expected_error_for_cat = ".*[Ff]orbidden.*"
+  else:
+    expected_error_for_cat = ".*svn: E170001: Authorization failed.*"
+

Do you mean to reinstate errorcodes(E175013, E175013, E175009) check ?

With regards
Kamesh Jayachandran

Re: svn commit: r1068411 - /subversion/trunk/subversion/tests/cmdline/authz_tests.py

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Hyrum K Wright wrote on Fri, Feb 11, 2011 at 18:09:14 +0000:
> On Fri, Feb 11, 2011 at 5:59 PM, Kamesh Jayachandran <ka...@collab.net> wrote:
> >>kameshj@apache.org wrote on Tue, Feb 08, 2011 at 14:25:06 -0000:
> >>> +  expected_error_for_cat = "svn: E175013: Unable to connect to a
> >>> repository"+ \
> >>> +                            " at URL '" + mu_url + "'\n" + \
> >>> +                            "svn: E175013: Access to '/" + mu_repo_path
> >>> + \
> >>> +                            "' forbidden\n" + \
> >>> +                            "svn: E175009: XML parsing failed: (403
> >>> Forbidden)"
> >
> >>Bad idea to hard code so much of the specific message we're generating
> >>today; it's bound to change later.
> >
> >>(eg, the XML parsing thing would ideally go away at some point)
> >
> >>Just 'Access.*${mu_url}.*forbidden' is enough IMO.
> >
> >
> > Thanks We fixed this in r1068802 Still we have "E170001:" for svnserve would
> > remove it as soon as I reach before my working copy.

Thanks.  But why remove the E170001?  Its very purpose is to provide
a machine-readable identification of the error... (exactly what tests
need)

Re: svn commit: r1068411 - /subversion/trunk/subversion/tests/cmdline/authz_tests.py

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Hyrum K Wright wrote on Fri, Feb 11, 2011 at 18:09:14 +0000:
> On Fri, Feb 11, 2011 at 5:59 PM, Kamesh Jayachandran <ka...@collab.net> wrote:
> >>kameshj@apache.org wrote on Tue, Feb 08, 2011 at 14:25:06 -0000:
> >>> +  expected_error_for_cat = "svn: E175013: Unable to connect to a
> >>> repository"+ \
> >>> +                            " at URL '" + mu_url + "'\n" + \
> >>> +                            "svn: E175013: Access to '/" + mu_repo_path
> >>> + \
> >>> +                            "' forbidden\n" + \
> >>> +                            "svn: E175009: XML parsing failed: (403
> >>> Forbidden)"
> >
> >>Bad idea to hard code so much of the specific message we're generating
> >>today; it's bound to change later.
> >
> >>(eg, the XML parsing thing would ideally go away at some point)
> >
> >>Just 'Access.*${mu_url}.*forbidden' is enough IMO.
> >
> >
> > Thanks We fixed this in r1068802 Still we have "E170001:" for svnserve would
> > remove it as soon as I reach before my working copy.

Thanks.  But why remove the E170001?  Its very purpose is to provide
a machine-readable identification of the error... (exactly what tests
need)

Re: svn commit: r1068411 - /subversion/trunk/subversion/tests/cmdline/authz_tests.py

Posted by Hyrum K Wright <hy...@hyrumwright.org>.
On Fri, Feb 11, 2011 at 5:59 PM, Kamesh Jayachandran <ka...@collab.net> wrote:
>>kameshj@apache.org wrote on Tue, Feb 08, 2011 at 14:25:06 -0000:
>>> +  expected_error_for_cat = "svn: E175013: Unable to connect to a
>>> repository"+ \
>>> +                            " at URL '" + mu_url + "'\n" + \
>>> +                            "svn: E175013: Access to '/" + mu_repo_path
>>> + \
>>> +                            "' forbidden\n" + \
>>> +                            "svn: E175009: XML parsing failed: (403
>>> Forbidden)"
>
>>Bad idea to hard code so much of the specific message we're generating
>>today; it's bound to change later.
>
>>(eg, the XML parsing thing would ideally go away at some point)
>
>>Just 'Access.*${mu_url}.*forbidden' is enough IMO.
>
>
> Thanks We fixed this in r1068802 Still we have "E170001:" for svnserve would
> remove it as soon as I reach before my working copy.

Note that instead of having to parse the error yourself, you can now
just give the error code for the expected error, and it should Do The
Right Thing.  (Error codes can be found in svntest.err)

-Hyrum

Re: svn commit: r1068411 - /subversion/trunk/subversion/tests/cmdline/authz_tests.py

Posted by Hyrum K Wright <hy...@hyrumwright.org>.
On Fri, Feb 11, 2011 at 5:59 PM, Kamesh Jayachandran <ka...@collab.net> wrote:
>>kameshj@apache.org wrote on Tue, Feb 08, 2011 at 14:25:06 -0000:
>>> +  expected_error_for_cat = "svn: E175013: Unable to connect to a
>>> repository"+ \
>>> +                            " at URL '" + mu_url + "'\n" + \
>>> +                            "svn: E175013: Access to '/" + mu_repo_path
>>> + \
>>> +                            "' forbidden\n" + \
>>> +                            "svn: E175009: XML parsing failed: (403
>>> Forbidden)"
>
>>Bad idea to hard code so much of the specific message we're generating
>>today; it's bound to change later.
>
>>(eg, the XML parsing thing would ideally go away at some point)
>
>>Just 'Access.*${mu_url}.*forbidden' is enough IMO.
>
>
> Thanks We fixed this in r1068802 Still we have "E170001:" for svnserve would
> remove it as soon as I reach before my working copy.

Note that instead of having to parse the error yourself, you can now
just give the error code for the expected error, and it should Do The
Right Thing.  (Error codes can be found in svntest.err)

-Hyrum

RE: svn commit: r1068411 - /subversion/trunk/subversion/tests/cmdline/authz_tests.py

Posted by Kamesh Jayachandran <ka...@collab.net>.
>kameshj@apache.org wrote on Tue, Feb 08, 2011 at 14:25:06 -0000:
>> +  expected_error_for_cat = "svn: E175013: Unable to connect to a repository"+ \
>> +                            " at URL '" + mu_url + "'\n" + \
>> +                            "svn: E175013: Access to '/" + mu_repo_path + \
>> +                            "' forbidden\n" + \
>> +                            "svn: E175009: XML parsing failed: (403 Forbidden)"

>Bad idea to hard code so much of the specific message we're generating
>today; it's bound to change later.

>(eg, the XML parsing thing would ideally go away at some point)

>Just 'Access.*${mu_url}.*forbidden' is enough IMO.


Thanks We fixed this in r1068802 Still we have "E170001:" for svnserve would remove it as soon as I reach before my working copy.

With regards
Kamesh Jayachandran

RE: svn commit: r1068411 - /subversion/trunk/subversion/tests/cmdline/authz_tests.py

Posted by Kamesh Jayachandran <ka...@collab.net>.
>kameshj@apache.org wrote on Tue, Feb 08, 2011 at 14:25:06 -0000:
>> +  expected_error_for_cat = "svn: E175013: Unable to connect to a repository"+ \
>> +                            " at URL '" + mu_url + "'\n" + \
>> +                            "svn: E175013: Access to '/" + mu_repo_path + \
>> +                            "' forbidden\n" + \
>> +                            "svn: E175009: XML parsing failed: (403 Forbidden)"

>Bad idea to hard code so much of the specific message we're generating
>today; it's bound to change later.

>(eg, the XML parsing thing would ideally go away at some point)

>Just 'Access.*${mu_url}.*forbidden' is enough IMO.


Thanks We fixed this in r1068802 Still we have "E170001:" for svnserve would remove it as soon as I reach before my working copy.

With regards
Kamesh Jayachandran

Re: svn commit: r1068411 - /subversion/trunk/subversion/tests/cmdline/authz_tests.py

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
kameshj@apache.org wrote on Tue, Feb 08, 2011 at 14:25:06 -0000:
> +  expected_error_for_cat = "svn: E175013: Unable to connect to a repository"+ \
> +                            " at URL '" + mu_url + "'\n" + \
> +                            "svn: E175013: Access to '/" + mu_repo_path + \
> +                            "' forbidden\n" + \
> +                            "svn: E175009: XML parsing failed: (403 Forbidden)"

Bad idea to hard code so much of the specific message we're generating
today; it's bound to change later.

(eg, the XML parsing thing would ideally go away at some point)

Just 'Access.*${mu_url}.*forbidden' is enough IMO.

Re: svn commit: r1068411 - /subversion/trunk/subversion/tests/cmdline/authz_tests.py

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
kameshj@apache.org wrote on Tue, Feb 08, 2011 at 14:25:06 -0000:
> +  expected_error_for_cat = "svn: E175013: Unable to connect to a repository"+ \
> +                            " at URL '" + mu_url + "'\n" + \
> +                            "svn: E175013: Access to '/" + mu_repo_path + \
> +                            "' forbidden\n" + \
> +                            "svn: E175009: XML parsing failed: (403 Forbidden)"

Bad idea to hard code so much of the specific message we're generating
today; it's bound to change later.

(eg, the XML parsing thing would ideally go away at some point)

Just 'Access.*${mu_url}.*forbidden' is enough IMO.