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

Re: ra_dav and svn_recurse_kind

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2005-04-29 21:20:12 CEST

Philip Martin <philip@codematters.co.uk> writes:

> When I build ra_dav I see
> ../svn/subversion/libsvn_ra_dav/merge.c: In function 'okay_to_bump_path':
> ../svn/subversion/libsvn_ra_dav/merge.c:151: warning: cast from function call of type 'void *' to non-matching type 'enum svn_recurse_kind'
> On investigation it looks a bit odd, the code in question is
> 149: r = (enum svn_recurse_kind) apr_hash_get (valid_targets,
> 150: parent_path->data,
> 152: if (r == svn_recursive)
> 153: return TRUE;
> The cast is a bit odd, and there is more that is odd where the hash
> appears to get set in commit.c:add_valid_target()
> static void
> add_valid_target (commit_ctx_t *cc,
> const char *path,
> enum svn_recurse_kind kind)
> {
> apr_hash_t *hash = cc->valid_targets;
> svn_string_t *path_str = svn_string_create(path, apr_hash_pool_get(hash));
> apr_hash_set (hash, path_str->data, path_str->len, &kind);
> }
> It looks like it's storing a stack address in the hash, I don't think
> that makes sense.

I've worked out how to trigger this bug

svnadmin create repo
svn mkdir $REPO/foo $REPO/foo/bar
svn co $REPO wc
svn ps x x wc
svn cp $REPO/foo wc/zig
svn mkdir wc/zig/bar/baz
svn ci wc

Using gdb on the commit I see add_valid_target gets called three
times, one of which is for path="zig" with kind=svn_recursive. Later
in okay_to_bump_path I see this

Breakpoint 3, okay_to_bump_path (path=0x80ac828 "zig/bar",
    valid_targets=0x809b158, pool=0x809eae0)
    at ../svn/subversion/libsvn_ra_dav/merge.c:149
149 r = (enum svn_recurse_kind) apr_hash_get (valid_targets,
(gdb) p parent_path->data
$30 = 0x80ac838 "zig"
(gdb) n
152 if (r == svn_recursive)
(gdb) p r
$31 = 3221222280

That value of r is obviously rubbish (remember it's a stack address)
so I fix it in the debugger

(gdb) set var r = 2

and the code continues to push_wc_prop

push_wc_prop (baton=0x808bd30, relpath=0x80ac828 "zig/bar",
    name=0x40123448 "svn:wc:ra_dav:version-url", value=0xbffff054,
    pool=0x809eae0) at ../svn/subversion/libsvn_client/ra.c:123
123 svn_client__callback_baton_t *cb = baton;

Now push_wc_prop iterates over commit_items comparing the relpath
against each items url. The urls are "", "zig", "zig/bar/baz" none of
which match relpath, so push_wc_prop does nothing. I haven't got a
clue whats going on: the dav later appears to be setting a version-url
and the client layer is ignoring it. Once the commit is completed if
I look at the wc there are no dir-wcprops on "zig/bar". Why does the
client layer (push_wc_prop) veto the dav layer's attempts to store

Philip Martin
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Apr 29 21:21:16 2005

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