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

Re: path.c:113: svn_path_join: Assertion `is_canonical (base, blen)' failed.

From: Ben Reser <ben_at_reser.org>
Date: 2004-08-26 20:43:04 CEST

On Thu, Aug 26, 2004 at 11:20:36AM -0400, Greg Hudson wrote:
> There's no real problem here, since such a path is non-canonical (and
> thus unusual) and in the same form as a URI. Certainly, if we were to
> add support for a foo URI scheme, it would be better that foo://bar
> pathnames already didn't work.

Well it's not canonical if you're treating it as a local path. But it
is canonical as a URI. Which is what I realized a little bit further
down in the email. The problem is we have no way to say to
svn_path_canonicalize() "We never accepts URLs. Canonicalize as though
everything were a local path."

> > Thus I propose that svn_path_dirname() be fixed to understand that the
> > hostname portion of a URI is the root and can not be split.
> > svn_path_basename() will also have to be adjusted so it can recognize
> > when this occurs and return no basename.
>
> -1. svn_path_dirname accepts a canonical path (not URL;
> svn_path_canonicalize is documented as accepting a URL, but
> svn_path_dirname is not). Canonical paths do not have double slashes,
> contrary to what you said in your response to yourself.

Okay you're right canonical paths do not have double slashes except for
in the case of a URL. However, svn_path_dirname() is documented as
accepting any canonical path. IMHO canonical path is defined by the
output of svn_path_canonicalize(). Thus svn_path_dirname() accepts URLs
provided they've been canonicalized.

Either I'm right and svn_path_dirname() should be fixed or you're right
and svn_path.h's documentation needs some work.

But ignoring who's right or wrong let's look at the implications of your
view here. If svn_path_dirname() does not accept URLs that means every
app that uses it *MUST* call svn_path_is_url() prior to calling it to
ensure they won't get an assert. Why? Because as you point out a
double slash is technically not a canonical path, thus
svn_path_dirname() should end up in a non-canonical result for
"foo//bar", but r10732 stops that from happening and is wrong.

Additionally, svn_path_is_url is documented as:
/** Return @c TRUE iff @a path looks like a valid URL, @c FALSE
otherwise. */

Uhh so paths can be URLs!?!? This totally doesn't agree with what you
seem to be saying. Neither does the naming of svn_path_is_url().

In the end apps are going to have to be writing:
if (svn_path_is_url (path))
  {
    // their own path splitting stuff for URLs that works properly
  }
else
  {
    dirname = svn_path_dirname (path,pool);
  }

And that seems a tad silly when some pretty minimal changes could just
let them do:
dirname = svn_path_dirname (path,pool);

-- 
Ben Reser <ben@reser.org>
http://ben.reser.org
"Conscience is the inner voice which warns us somebody may be looking."
- H.L. Mencken
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Aug 26 20:43:17 2004

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.