You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by SteveKing <st...@gmx.ch> on 2005/06/23 17:22:35 UTC
possible crash in svn_client_uuid_from_path
Hi,
An analysis of a crashreport sent in for TSVN I discovered that
svn_client_uuid_from_path() can crash under certain circumstances.
TSVN calls this function like this:
svn_wc_adm_access_t *adm_access;
SVN_ERR (svn_wc_adm_probe_open2 (&adm_access, NULL, target,
FALSE, 0, pool));
SVN_ERR (svn_client_uuid_from_path(UUID, target, adm_access, m_pctx,
pool));
SVN_ERR (svn_wc_adm_close (adm_access));
with UUID being 'const char **' and target being a path to a local
working copy in form 'const char *'.
Now, this is how the crash occurs:
In svn_client_uuid_from_path() this is the code:
{
const svn_wc_entry_t *entry;
SVN_ERR (svn_wc_entry (&entry, path, adm_access,
TRUE, /* show deleted */ pool));
if (! entry)
return svn_error_createf (SVN_ERR_ENTRY_NOT_FOUND, NULL,
_("Can't find entry for '%s'"),
svn_path_local_style (path, pool));
if (entry->uuid)
{
*uuid = entry->uuid;
}
else
{
/* fallback to using the network. */
SVN_ERR (svn_client_uuid_from_url (uuid, entry->url, ctx, pool));
}
return SVN_NO_ERROR;
}
The problem is that for certain paths (nested layout), the function uses
the 'fallback to using the network', but not only entry->uuid is NULL,
but also entry->url! So with entry->url being NULL, the called API's crash:
svn_client_uuid_from_url() (ra.c: line 308)
svn_client__open_ra_session() (ra_loader.c: line 249)
has_scheme_of() (ra_loader.c: line 197)
--> crash in strncasecmp() because the URL is NULL.
All this with Subversion 1.2.
Haven't tested it with HEAD though.
Stefan
--
___
oo // \\ "De Chelonian Mobile"
(_,\/ \_/ \ TortoiseSVN
\ \_/_\_/> The coolest Interface to (Sub)Version Control
/_/ \_\ http://tortoisesvn.tigris.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: possible crash in svn_client_uuid_from_path
Posted by SteveKing <st...@gmx.ch>.
Sorry for being late.
Philip Martin wrote:
> Can you reproduce it? I'm thinking of fixing it as shown below but
> the only way I can test it is by tweaking values in gdb when doing a
> repo-to-wc copy.
Well, *I* can't, but I've sent a special TSVN version with your patch
included to the one who sent the crashreport (this one speaks english).
He tried it on his working copy, and the crash is gone now! Thanks!
One other thing: I'm really sorry but I messed things up a little here.
When I received the crashreport, I asked the guy some questions to
figure out what's going on. I then also asked he should check the
entries file in the .svn folder. He told me that there's no 'url' entry
in there. He couldn't tell however how this could happen.
Then I sent the special version, he tried it and it worked. But now, the
entries file has the url entry present! So the messed up entries file is
gone, sorry for that. I completely forgot to ask he'd send me that file
so you guys may be able to figure out why this happened.
FYI: TSVN calls svn_client_uuid_from_path() for the commit dialog. The
uuid is used to identify the working copy for which the previous log
messages are locally stored (so the user can get such an entered message
back without re-typing it). It's also done before an update, to find out
if all update-targets are from the same repository (and if they are,
they're updated not to HEAD but to the revision number which HEAD points
to - that way all targets are updated to the *same* revision even if a
commit happens in between the different updates.)
So the guy was finally able to do an update on his working copy, but
that fixed his entries file.
So once again, sorry for messing things up, and thanks a lot for fixing
this!
Stefan
--
___
oo // \\ "De Chelonian Mobile"
(_,\/ \_/ \ TortoiseSVN
\ \_/_\_/> The coolest Interface to (Sub)Version Control
/_/ \_\ http://tortoisesvn.tigris.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: possible crash in svn_client_uuid_from_path
Posted by Philip Martin <ph...@codematters.co.uk>.
SteveKing <st...@gmx.ch> writes:
> TSVN calls this function like this:
>
> svn_wc_adm_access_t *adm_access;
> SVN_ERR (svn_wc_adm_probe_open2 (&adm_access, NULL, target,
> FALSE, 0, pool));
> SVN_ERR (svn_client_uuid_from_path(UUID, target, adm_access,
> m_pctx, pool));
> SVN_ERR (svn_wc_adm_close (adm_access));
>
> with UUID being 'const char **' and target being a path to a local
> working copy in form 'const char *'.
Can you reproduce it? I'm thinking of fixing it as shown below but
the only way I can test it is by tweaking values in gdb when doing a
repo-to-wc copy.
Index: subversion/libsvn_client/ra.c
===================================================================
--- subversion/libsvn_client/ra.c (revision 15163)
+++ subversion/libsvn_client/ra.c (working copy)
@@ -349,11 +349,24 @@
{
*uuid = entry->uuid;
}
- else
+ else if (entry->url)
{
/* fallback to using the network. */
SVN_ERR (svn_client_uuid_from_url (uuid, entry->url, ctx, pool));
}
+ else
+ {
+ /* try the parent if it's the same working copy */
+ svn_boolean_t is_root;
+ SVN_ERR (svn_wc_is_wc_root (&is_root, path, adm_access, pool));
+ if (is_root)
+ return svn_error_createf (SVN_ERR_ENTRY_MISSING_URL, NULL,
+ _("'%s' has no URL"),
+ svn_path_local_style (path, pool));
+ else
+ return svn_client_uuid_from_path (uuid, svn_path_dirname (path, pool),
+ adm_access, ctx, pool);
+ }
return SVN_NO_ERROR;
}
--
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org