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

[PATCH] Re: [BUG] svn ls file:///

From: Uwe Zeisberger <zeisberg_at_informatik.uni-freiburg.de>
Date: 2004-11-16 17:07:51 CET

Hello,

Peter N. Lundblad wrote:
> On Fri, 5 Nov 2004, Uwe Zeisberger wrote:
> > if I issue the command
> >
> > svn log file:///
> >
> > (in a wc or not) I get:
> >
> > Assertion failed: is_canonical (path, len), file [..]/subversion/libsvn_subr/path.c, line 376
> > Abort
> >
> > I think file:/// is a valid url standing for '/'. (Please correct me, if
> > I'm wrong.)
> >
> > If file:/// is a valid (and canonical) path, is_canonical
> > (defined in path.c, line 95+) returns a wrong result (namely false).
> >
> Yes, it should skip the scheme and host parts before treating it like a
> path.
>
> Also, svn_path_canonicalize is buggy in that it strips the trailing slash
> in this case.
From RFC 1738 Section 3.1:
  ... common syntax for the scheme-specific data:

    //<user>:<password>@<host>:<port>/<url-path>

  [...] "/<url-path>" may be excluded.

So "file://" and "file:///" are the same. Stripping a slash from
"file://" (as svn_path_canonicalize does) is however an error.

I attach a patch, which let subversion accept "file://".

I didn't change the assertions, which assume, that a canonical pathname
does not end with a slash. `svn log file:///' doesn't fail with an
assertion any more and I didn't found an other way to provoke this
failure, yet. I believe, there is still work to be done.

Heres the log:

[[[
Fix a part from issue #2116: 'svn log file:///' results in a failed assertion

These changes add the correct handling for "file://"

* subversion/libsvn_subr/path.c
  (skip_uri_schema): also find :// at the end of path
  (svn_path_canonicalize): don't strip a leading slash from "file://"

* subversion/libsvn_ra_local/split_url.c
  (svn_ra_local__split_URL): handle "file://" correctly

* subversion/tests/libsvn_subr/path-test.c
  (test_is_url): add "file:///" -> TRUE, "file://" -> TRUE and
  "file:/" -> FALSE
  (test_canonicalize): add "file:///" -> "file://", "file://" ->
  "file://", "file:///usr/" -> "file:///usr", "file:///usr" -> "file:///usr"
]]]

-- 
Uwe Zeisberger
http://www.google.com/search?q=i+squared

Received on Tue Nov 16 17:08:11 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.