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

Re: SEGFAULT in 'svn pget' (no time to diagnose)

From: Blair Zajac <blair_at_orcaware.com>
Date: 2007-10-31 16:48:30 CET

Blair Zajac wrote:
> C. Michael Pilato wrote:
>> Ouch.
>>
>> $ svn pget svn:mergeinfo .@BASE
>> svn: subversion/libsvn_subr/path.c:119: svn_path_join: Assertion
>> `is_canonical(base, blen)' failed.
>> Aborted (core dumped)
>>
>> I remember seeing something about svn_opt_parse_path() not canonicalizing
>> paths any more, or somesuch. Perhaps that's to blame here.
>
> I'll take a look at it.

So the problem is related to svn_opt_args_to_target_array2().

When a "." appears there, then

           apr_err = apr_filepath_merge(&truenamed_target, "", apr_target,
                                        APR_FILEPATH_TRUENAME, pool);

ends up getting a "." and converts it into a "" so its canonical.

When a ".@BASE" appears, then it's not canonicalized into "@BASE" and because
svn_opt_parse_path() no longer canonicalizes the path, "." never gets
canonicalized into "".

The documentation for svn_opt_args_to_target_array2() states:

   On each local path, canonicalize case and path separators, and
   silently skip it if it has the same name as a Subversion working
   copy administrative directory.

Which doesn't sound exactly the same as the path is just canonicalized. Maybe
this language should be made clearer. But does

So I see two choices:

1) Make svn_opt_args_to_target_array2() smarter and have it use
svn_opt_parse_path() to split the path into path and peg revision, pass the path
into apr_filepath_merge(), then append the appropriate @PEG string back onto it.

This requires no changes from the caller, but now
svn_opt_args_to_target_array2() can return an error if somebody tries an unknown
peg revision, say @FOOBAR, when before it would not.

2) Leave svn_opt_args_to_target_array2() alone but iterate over the result of
its return in every caller of svn_opt_args_to_target_array2() to have it
canonicalize the path.

This sounds messy.

While we're in svn_opt_args_to_target_array2(), a couple of questions:

If the target is a URL, then it does this:

           /* strip any trailing '/' */
           target = svn_path_canonicalize(target, pool);

But this does nothing for a URL with a peg revision.

So I'm thinking of having the code use svn_opt_parse_path() before doing any
checking if the input is a URL or path, separate the path/URL from the peg
revision, then appending it at the very end.

Is it safe to do that, given that paths are run through these steps? Are there
any UTF-8 issues I need to be aware of, in the following Python pseudo code?

(peg_rev, path) = svn_opt_parse_path(path)
path = svn_path_cstring_from_utf8(path)
path = apr_filepath_merge(path)
path = svn_path_cstring_to_utf8(path)
path = svn_path_canonicalize(path)
path = "%s@%s" % (path, peg_rev)

Blair

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Oct 31 16:48:48 2007

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.