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/11/25 17:01:12 UTC
svn commit: r1716450 - in /subversion/trunk/subversion:
libsvn_ra_serf/lock.c mod_dav_svn/lock.c tests/cmdline/authz_tests.py
tests/cmdline/lock_tests.py
Author: rhuijben
Date: Wed Nov 25 16:01:12 2015
New Revision: 1716450
URL: http://svn.apache.org/viewvc?rev=1716450&view=rev
Log:
Improve error message handling on two lock operations via ra_serf. These
errors still relied on the http reason string for the user visible text.
This fixes a serf/mod_dav TODO and two http/2 test failures.
* subversion/libsvn_ra_serf/lock.c
(run_locks): Tweak text on 304. This was not unlock specific.
Prefer 423 text from server if it looks valid.
* subversion/mod_dav_svn/lock.c
(get_locks): Add another lie to this function, that already has a few.
* subversion/tests/cmdline/authz_tests.py
(authz_locking): Allow other text. Expecting an unlock error when
performing an 'svn lock' doesn't make much sense.
* subversion/tests/cmdline/lock_tests.py
(unlocked_lock_of_other_user): Expect same error on all ra layers.
Modified:
subversion/trunk/subversion/libsvn_ra_serf/lock.c
subversion/trunk/subversion/mod_dav_svn/lock.c
subversion/trunk/subversion/tests/cmdline/authz_tests.py
subversion/trunk/subversion/tests/cmdline/lock_tests.py
Modified: subversion/trunk/subversion/libsvn_ra_serf/lock.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/lock.c?rev=1716450&r1=1716449&r2=1716450&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/lock.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/lock.c Wed Nov 25 16:01:12 2015
@@ -267,10 +267,9 @@ run_locks(svn_ra_serf__session_t *sess,
/* ### Authz can also lead to 403. */
err = svn_error_createf(SVN_ERR_FS_LOCK_OWNER_MISMATCH,
NULL,
- _("Unlock of '%s' failed (%d %s)"),
- ctx->path,
- ctx->handler->sline.code,
- ctx->handler->sline.reason);
+ _("Not authorized to perform lock "
+ "operation on '%s'"),
+ ctx->path);
break;
case 405:
err = svn_error_createf(SVN_ERR_FS_OUT_OF_DATE,
@@ -282,13 +281,20 @@ run_locks(svn_ra_serf__session_t *sess,
ctx->handler->sline.reason);
break;
case 423:
- err = svn_error_createf(SVN_ERR_FS_PATH_ALREADY_LOCKED,
- NULL,
- _("Path '%s' already locked "
- "(%d %s)"),
- ctx->path,
- ctx->handler->sline.code,
- ctx->handler->sline.reason);
+ if (server_err
+ && SVN_ERROR_IN_CATEGORY(server_err->apr_err,
+ SVN_ERR_FS_CATEGORY_START))
+ {
+ err = NULL;
+ }
+ else
+ err = svn_error_createf(SVN_ERR_FS_PATH_ALREADY_LOCKED,
+ NULL,
+ _("Path '%s' already locked "
+ "(%d %s)"),
+ ctx->path,
+ ctx->handler->sline.code,
+ ctx->handler->sline.reason);
break;
case 404:
Modified: subversion/trunk/subversion/mod_dav_svn/lock.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/lock.c?rev=1716450&r1=1716449&r2=1716450&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/lock.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/lock.c Wed Nov 25 16:01:12 2015
@@ -487,6 +487,18 @@ get_locks(dav_lockdb *lockdb,
svn_lock_to_dav_lock(&lock, slock, info->lock_break,
resource->exists, resource->pool);
+ /* If we are talking to an svn client that wants to unlock a
+ path, tell mod_dav that the lock is owned by the user trying
+ to unlock. This stops it from returning an error that we
+ can't use in the client, and allows us to return the actual
+ unlock error */
+ if (info->r->method_number == M_UNLOCK
+ && resource->info->repos->is_svn_client
+ && resource->info->repos->username)
+ {
+ lock->auth_user = resource->info->repos->username;
+ }
+
/* Let svn clients know the creationdate of the slock. */
apr_table_setn(info->r->headers_out, SVN_DAV_CREATIONDATE_HEADER,
svn_time_to_cstring(slock->creation_date,
@@ -937,6 +949,11 @@ remove_lock(dav_lockdb *lockdb,
APLOG_WARNING);
}
+ else if (serr && serr->apr_err == SVN_ERR_FS_LOCK_OWNER_MISMATCH)
+ {
+ return dav_svn__convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
+ NULL, resource->pool);
+ }
else if (serr)
return dav_svn__convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
"Failed to remove a lock.",
Modified: subversion/trunk/subversion/tests/cmdline/authz_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/authz_tests.py?rev=1716450&r1=1716449&r2=1716450&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/authz_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/authz_tests.py Wed Nov 25 16:01:12 2015
@@ -782,7 +782,7 @@ def authz_locking(sbox):
sbox.ospath('A/mu'))
if sbox.repo_url.startswith('http'):
- expected_err = ".*svn: warning: W160039: Unlock.*[Ff]orbidden.*"
+ expected_err = ".*svn: warning: W160039: .*([Aa]uth.*perf|[Ff]orbidden).*"
else:
expected_err = ".*svn: warning: W170001: Authorization failed.*"
Modified: subversion/trunk/subversion/tests/cmdline/lock_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/lock_tests.py?rev=1716450&r1=1716449&r2=1716450&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/lock_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/lock_tests.py Wed Nov 25 16:01:12 2015
@@ -1360,11 +1360,8 @@ def unlocked_lock_of_other_user(sbox):
svntest.actions.run_and_verify_status(wc_dir, expected_status)
# now try to unlock with user jconstant, should fail but exit 0.
- if sbox.repo_url.startswith("http"):
- expected_err = "svn: warning: W160039: .*[Uu]nlock of .*403 Forbidden.*"
- else:
- expected_err = "svn: warning: W160039: User '%s' is trying to use a lock owned by "\
- "'%s'.*" % (svntest.main.wc_author2, svntest.main.wc_author)
+ expected_err = "svn: warning: W160039: User '%s' is trying to use a lock owned by "\
+ "'%s'.*" % (svntest.main.wc_author2, svntest.main.wc_author)
svntest.actions.run_and_verify_svn([], expected_err,
'unlock',
'--username', svntest.main.wc_author2,