You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2015/01/28 15:47:50 UTC

svn commit: r1655354 - in /subversion/trunk/subversion: mod_dav_svn/repos.c tests/cmdline/commit_tests.py

Author: rhuijben
Date: Wed Jan 28 14:47:50 2015
New Revision: 1655354

URL: http://svn.apache.org/r1655354
Log:
Resolve issue #2295, by making mod_dav produce an svn specific error report
on MKCOL requests that hit an existing resource during commit.

* subversion/mod_dav_svn/repos.c
  (prep_working): When parsing for mkcol, break out early.

* subversion/tests/cmdline/commit_tests.py
  (mkdir_conflict_proper_error): New test.
  (test_list): Add mkdir_conflict_proper_error.

Modified:
    subversion/trunk/subversion/mod_dav_svn/repos.c
    subversion/trunk/subversion/tests/cmdline/commit_tests.py

Modified: subversion/trunk/subversion/mod_dav_svn/repos.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/repos.c?rev=1655354&r1=1655353&r2=1655354&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/repos.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/repos.c Wed Jan 28 14:47:50 2015
@@ -1035,6 +1035,28 @@ prep_working(dav_resource_combined *comb
   comb->res.exists = (kind != svn_node_none);
   comb->res.collection = (kind == svn_node_dir);
 
+  if (comb->res.exists
+      && comb->priv.r->method_number == M_MKCOL
+      && comb->priv.repos->is_svn_client)
+    {
+      /* mod_dav will now continue returning a generic HTTP_METHOD_NOT_ALLOWED
+         error, which doesn't produce nice output on SVN, nor gives any details
+         on why the operation failed.
+
+         Let's error out a bit earlier and produce an error message that is
+         easier to understand for both clients and users. */
+
+      /* It would be nice if we could error out a bit later (see issue #2295),
+         like in create_collection(), but mod_dav outsmarts us by just
+         returning the error when the node exists. */
+
+      return dav_svn__convert_err(
+                  svn_error_createf(SVN_ERR_FS_ALREADY_EXISTS, NULL,
+                                    "Path already exists, path '%s'",
+                                    comb->priv.repos_path),
+                  HTTP_METHOD_NOT_ALLOWED, NULL, pool);
+    }
+
   return NULL;
 }
 

Modified: subversion/trunk/subversion/tests/cmdline/commit_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/commit_tests.py?rev=1655354&r1=1655353&r2=1655354&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/commit_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/commit_tests.py Wed Jan 28 14:47:50 2015
@@ -3123,6 +3123,18 @@ def commit_mergeinfo_ood(sbox):
   svntest.actions.run_and_verify_svn(None, None, expected_err,
                                      'commit', sbox.ospath(''), '-m', 'M')
 
+@Issue(2295)
+def mkdir_conflict_proper_error(sbox):
+  "mkdir conflict should produce a proper error"
+
+  sbox.build(create_wc=False)
+  repo_url = sbox.repo_url
+
+  expected_error = "svn: E160020: .* already exists.*'/A'"
+  svntest.actions.run_and_verify_svn(None, None, expected_error,
+                                     'mkdir', repo_url + '/A',
+                                     '-m', '')
+
 ########################################################################
 # Run the tests
 
@@ -3198,6 +3210,7 @@ test_list = [ None,
               commit_cp_with_deep_delete,
               commit_deep_deleted,
               commit_mergeinfo_ood,
+              mkdir_conflict_proper_error,
              ]
 
 if __name__ == '__main__':