You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Philip Martin <ph...@codematters.co.uk> on 2005/04/28 20:45:55 UTC

ra_dav and svn_recurse_kind

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,
151:                                              APR_HASH_KEY_STRING);
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.

-- 
Philip Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: ra_dav and svn_recurse_kind

Posted by Philip Martin <ph...@codematters.co.uk>.
Julian Foad <ju...@btopenworld.com> writes:

> Philip Martin wrote:
>> Philip Martin <ph...@codematters.co.uk> writes:
>>>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
>> REPO=http://localhost/repo
>> 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
>
> Could you add a regression test for that?

Tricky.  Fixing the bug didn't make any difference to the observable
behaviour, and I don't know whether or not the current behaviour is
correct.

-- 
Philip Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: ra_dav and svn_recurse_kind

Posted by Julian Foad <ju...@btopenworld.com>.
Philip Martin wrote:
> Philip Martin <ph...@codematters.co.uk> writes:
>>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
> 
> REPO=http://localhost/repo
> 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

Could you add a regression test for that?

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: ra_dav and svn_recurse_kind

Posted by Philip Martin <ph...@codematters.co.uk>.
Philip Martin <ph...@codematters.co.uk> writes:

> 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

I fixed this in r14594.

> (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
> version-urls?

This bit is still a mystery to me: why does the ra_dav layer have
explict code to set the property while the client layer has explicit
code to veto it?

-- 
Philip Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: ra_dav and svn_recurse_kind

Posted by Philip Martin <ph...@codematters.co.uk>.
Philip Martin <ph...@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,
> 151:                                              APR_HASH_KEY_STRING);
> 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

REPO=http://localhost/repo
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
version-urls?

-- 
Philip Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org