subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1139318 - in /subversion/trunk/subversion: libsvn_client/commit_util.c tests/cmdline/authz_tests.py
Date Fri, 24 Jun 2011 14:21:16 GMT
Author: rhuijben
Date: Fri Jun 24 14:21:15 2011
New Revision: 1139318

URL: http://svn.apache.org/viewvc?rev=1139318&view=rev
Log:
Following up on r1139198, extend the test to cover autz forbidden for all
the editor operations that are called from do_item_commit.

* subversion/libsvn_client/commit_util.c
  (fixup_commit_error): Look further in the error chain to find
    SVN_ERR_RA_DAV_FORBIDDEN.

* subversion/tests/cmdline/authz_tests.py
  (wc_commit_mkdir): Rename to ...
  (wc_commit_error_handling): ... this and extend to cover more editor
    operations.

Modified:
    subversion/trunk/subversion/libsvn_client/commit_util.c
    subversion/trunk/subversion/tests/cmdline/authz_tests.py

Modified: subversion/trunk/subversion/libsvn_client/commit_util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit_util.c?rev=1139318&r1=1139317&r2=1139318&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit_util.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit_util.c Fri Jun 24 14:21:15 2011
@@ -135,7 +135,7 @@ fixup_commit_error(const char *local_abs
                                                     path,
                                                     scratch_pool));
     }
-  else if (err->apr_err == SVN_ERR_RA_DAV_FORBIDDEN
+  else if (svn_error_find_cause(err, SVN_ERR_RA_DAV_FORBIDDEN)
            || err->apr_err == SVN_ERR_AUTHZ_UNWRITABLE)
     {
       if (ctx->notify_func2)

Modified: subversion/trunk/subversion/tests/cmdline/authz_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/authz_tests.py?rev=1139318&r1=1139317&r2=1139318&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/authz_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/authz_tests.py Fri Jun 24 14:21:15 2011
@@ -1241,21 +1241,91 @@ def wc_delete(sbox):
 
 
 @Skip(svntest.main.is_ra_type_file)
-def wc_commit_mkdir(sbox):
-  "commit a mkdir"
+def wc_commit_error_handling(sbox):
+  "verify commit error reporting"
 
   sbox.build()
   wc_dir = sbox.wc_dir
   write_restrictive_svnserve_conf(sbox.repo_dir)
 
+  sbox.simple_mkdir('A/Z')
+
+  write_authz_file(sbox, {'/'   : '* = r', })
+
+  # Creating editor fail: unfriendly error
+  expected_err = "(svn: E175013: .*orbidden.*)|" + \
+                 "(svn: E170001: Authorization failed)"
+  svntest.actions.run_and_verify_svn(None, None, expected_err,
+                                     'ci', wc_dir, '-m', '')
+
   write_authz_file(sbox, {'/'   : '* = rw',
                           '/A'  : '* = r', })
 
-  sbox.simple_mkdir('A/Z')
+  # Allow the informative error for dav and the ra_svn specific one that is
+  # returned on editor->edit_close().
+  expected_err = "(svn: E195023: Changing directory '.*Z' is forbidden)|" + \
+                 "(svn: E220004: Access denied)"
+  svntest.actions.run_and_verify_svn(None, None, expected_err,
+                                     'ci', wc_dir, '-m', '')
 
-  # Allow the generic 'nice' error and the ra_svn specif one that is returned
+  sbox.simple_revert('A/Z')
+
+  svntest.main.file_write(sbox.ospath('A/zeta'), "Zeta")
+  sbox.simple_add('A/zeta')
+
+  # Allow the informative error for dav and the ra_svn specific one that is
+  # returned on editor->edit_close().
+  expected_err = "(svn: E195023: Changing file '.*zeta' is forbidden)|" + \
+                 "(svn: E220004: Access denied)"
+  svntest.actions.run_and_verify_svn(None, None, expected_err,
+                                     'ci', wc_dir, '-m', '')
+  sbox.simple_revert('A/zeta')
+
+  sbox.simple_propset('a', 'b', 'A/D')
+
+  # Allow a generic dav error and the ra_svn specific one that is returned
   # on editor->edit_close().
-  expected_err = "(svn: E195023|: Changing directory '.*Z' is forbidden.)|" + \
+  expected_err = "(svn: E175013: .*orbidden.*)|" + \
+                 "(svn: E220004: Access denied)"
+  svntest.actions.run_and_verify_svn(None, None, expected_err,
+                                     'ci', wc_dir, '-m', '')
+
+  sbox.simple_revert('A/D')
+
+  sbox.simple_propset('a', 'b', 'A/B/lambda')
+
+  # Allow the informative error for dav and the ra_svn specific one that is
+  # returned on editor->edit_close().
+  expected_err = "(svn: E195023: Changing file '.*lambda' is forbidden.*)|" + \
+                 "(svn: E220004: Access denied)"
+  svntest.actions.run_and_verify_svn(None, None, expected_err,
+                                     'ci', wc_dir, '-m', '')
+
+  sbox.simple_revert('A/B/lambda')
+
+  svntest.main.file_write(sbox.ospath('A/B/lambda'), "New lambda")
+  # Allow the informative error for dav and the ra_svn specific one that is
+  # returned on editor->edit_close().
+  expected_err = "(svn: E195023: Changing file '.*lambda' is forbidden.*)|" + \
+                 "(svn: E220004: Access denied)"
+  svntest.actions.run_and_verify_svn(None, None, expected_err,
+                                     'ci', wc_dir, '-m', '')
+
+  sbox.simple_revert('A/B/lambda')
+
+  sbox.simple_rm('A/B/F')
+  # Allow the informative error for dav and the ra_svn specific one that is
+  # returned on editor->edit_close().
+  expected_err = "(svn: E195023: Changing directory '.*F' is forbidden.*)|" + \
+                 "(svn: E220004: Access denied)"
+  svntest.actions.run_and_verify_svn(None, None, expected_err,
+                                     'ci', wc_dir, '-m', '')
+  sbox.simple_revert('A/B/F')
+
+  svntest.main.file_write(sbox.ospath('A/mu'), "Updated mu")
+  # Allow the informative error for dav and the ra_svn specific one that is
+  # returned on editor->edit_close().
+  expected_err = "(svn: E195023: Changing file '.*mu' is forbidden.*)|" + \
                  "(svn: E220004: Access denied)"
   svntest.actions.run_and_verify_svn(None, None, expected_err,
                                      'ci', wc_dir, '-m', '')
@@ -1288,7 +1358,7 @@ test_list = [ None,
               case_sensitive_authz,
               authz_tree_conflict,
               wc_delete,
-              wc_commit_mkdir,
+              wc_commit_error_handling,
              ]
 serial_only = True
 



Mime
View raw message