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

[PATCH] Send path with lock token to fix issue 4369

From: Philip Martin <philip.martin_at_wandisco.com>
Date: Fri, 31 May 2013 19:40:40 +0100

http://subversion.tigris.org/issues/show_bug.cgi?id=4369

If I have broken locks the commit fails:

svnadmin create repo
svn -mm import repo/format file://`pwd`/repo/A/f
svn co http://localhost/obj/repo wc
svn lock wc/A/f
echo xx >> wc/A/f
svn lock --force file://`pwd`/repo/A/f
svn -mm ci wc

With 1.8/serf

svn: E175002: Commit failed (details follow):
svn: E175002: PUT of '/obj/repo/!svn/txr/1-2/A/f': 412 Precondition Failed

With 1.7/neon

svn: E195022: File '/home/pm/sw/subversion/obj/wc/A/f' is locked in another working copy
svn: E170007: No lock on path '/obj/repo/!svn/txr/1-3/A/f' (Status 423 on PUT Request)
svn: E175002: Server sent unexpected return value (423 Locked) in response to PUT request for '/obj/repo/!svn/txr/1-3/A/f'

The reason appears to be that 1.8/serf sends lock tokens in If headers
without an URI:

If: (<opaquelocktoken:d5b2cb02-34e1-4893-ba8d-ccbcc22fd953>)

and apache responds with a 412 while 1.7/neon sends an URI:

If: <http://localhost:9630/obj/repo/A/f> (<opaquelocktoken:ad688167-ca91-43b9-9d28-f3b8b672ecb9>)

and apache responds with a 423.

What sort of URI do we have to supply? Will a session relative <f> do?
Or a server relative </obj/repo/A/f>? Or a full scheme/host/port/path?

How about this for server relative:

Index: subversion/libsvn_ra_serf/commit.c
===================================================================
--- subversion/libsvn_ra_serf/commit.c (revision 1488294)
+++ subversion/libsvn_ra_serf/commit.c (working copy)
@@ -804,8 +804,12 @@
       if (token)
         {
           const char *token_header;
+ const char *token_path
+ = svn_path_url_add_component2(commit_ctx->session->session_url.path,
+ relpath, pool);
 
- token_header = apr_pstrcat(pool, "(<", token, ">)", (char *)NULL);
+ token_header = apr_pstrcat(pool, "<", token_path, "> (<", token, ">)",
+ (char *)NULL);
           serf_bucket_headers_set(headers, "If", token_header);
         }
     }

-- 
Certified & Supported Apache Subversion Downloads:
http://www.wandisco.com/subversion/download
Received on 2013-05-31 20:41:15 CEST

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.