On 10/05/2010 04:21 AM, vijayaguru wrote:
> Hi,
> 
> I had a chance to look into the code subversion/libsvn_ra_neon/commit.c.
> There was a portion of code(commit.c:485) in  (checkout_resource)
> function that I could not understand in which case it will get executed.
> Please let me know when this part of code will get exercised. 
> 
> <snip>
> 
>   if (err == NULL && allow_404 && code == 404)
>     {
>       locn = NULL;
> 
>       /* re-fetch, forcing a query to the server */
>       SVN_ERR(get_version_url(cc, NULL, rsrc, TRUE, pool));
> 
>       /* do it again, but don't allow a 404 this time */
>       err = do_checkout(cc, rsrc->vsn_url, FALSE, token,
>                         is_vcc, &code, &locn, pool);
>     }
> 
> <snip>

It's been a while since I went swimming in these waters, but I think what
happens is that once we know the version resource URL for a directory, we
first assume that the version resource URL for a child of that directory is
just urlof(directory) + basename(child).  We do this to avoid extra
communication with the server.  The checkout code then tries to checkout
that calculated version resource URL, but allows as a non-fatal condition a
server response of "404 Not Found".  If that happens, instead, we actually
contact the server to get the correct version resource URL for the child
resource, then retry the checkout.

> For example, in (commit_open_file), file_rsrc that is the duplicate of
> rsrc is passed to 'checkout_resource'. If the above mentioned portion of
> code(allow_404 &&code=404) is exercised in this case, Will it cause any
> problem since we are not duplicating the *name of resource* in
> 'dup_resource'.

It will only cause problems if the duplicated resource is used beyond the
pool lifetime of the original.  But this definitely is a bug in
dup_resource(), which claims to do a deep copy of the object without any
exceptions.  I'll fix this in a minute.

-- 
C. Michael Pilato <cmpil...@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to