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

Re: [Issue 1779] svn_path_canonicalize() doesn't handle double path separators

From: Ben Reser <ben_at_reser.org>
Date: 2004-03-11 08:21:04 CET

On Thu, Mar 11, 2004 at 04:32:34AM -0000, kfogel@tigris.org wrote:
> If so, perhaps the right answer is that Subversion should error right
> away, instead of permitting the non-standard (?) double-slash syntax.
> I know Emacs handles double-slash specially, but other than that, is
> there any precedent for interpreting it as a single slash?

Unix in general has always done this:
$ ls -l //dev//null
crw-rw-rw- 1 root root 1, 3 Dec 31 1969 //dev//null

$ ls -l /dev/null
crw-rw-rw- 1 root root 1, 3 Dec 31 1969 /dev/null

Apache does this except in certain configuration options where they've
determined it is useful to not to interpret multiple slashes as one:
http://httpd.apache.org/docs-2.0/mod/core.html#location
(scroll down to "Note about / (slash)")

I'd say that Emacs is downright unusual in its handling.

However, I do not think it is appropriate for svn_path_canonicalize() to
remove multiple slashes.

It is possible for multiple slashes to return something different if
you configure Apache in such a way that it does. So removing the
multiple slashes is not correct for http URLs.

We already support handling mutliple slashes in our URLS:
svn cat http://svn.collab.net/repos//svn/trunk//README

$ svnadmin create repo
$ svn co file://`pwd`/repo wc
$ cd wc
$ echo 'foo' > foo
$ svn add foo
A foo
$ svn ci -m 'add foo' foo
Adding foo
Transmitting file data .
Committed revision 1.
$ cd ..
$ svn cat file://`pwd`///repo///foo
foo
$ svn cp -m 'copy foo to foo2' file://`pwd`///repo///foo
file://`pwd`///repo/foo2
Committed revision 2.

I think this problem really has nothing to do with
svn_path_canonicalize(). But rather has to do with a multiple slash
in certain DAV METHODS.

The following demonstrates it (different test repo I keep around for
testing binding authentication):
$ export R=https://localhost/svn/test/
$ svn co ${R}/ wc2
A wc2/foo
Checked out revision 4.
$ cd wc2
$ svn cp ${R}/foo ${R}/foo2
svn: subversion/libsvn_subr/path.c:156: svn_path_join: Assertion
`is_canonical (base, blen)' failed.
Aborted

(same problem so far as reported, but let's try something else):

$ svn mkdir -m 'make subdir' ${R}/bar
Committed revision 5.

(Note the full URL there has a double slash)

$ svn cp -m 'cp foo to bar subdir' ${R}/foo ${R}/bar//
svn: subversion/libsvn_subr/path.c:156: svn_path_join: Assertion
`is_canonical (base, blen)' failed.
Aborted

$ svn cp -m 'cp foo to bar subdir' ${R}foo ${R}/bar//
svn: PROPFIND request failed on '/bar'
svn: PROPFIND of '/bar': 405 Method Not Allowed (https://localhost)

$ svn cp -m 'cp foo to bar subdir' ${R}foo ${R}bar//
Committed revision 6.

$ svn mkdir -m 'make subdir2' ${R}bar//bang
Committed revision 7.

$ svn cp -m 'cp foo to bar/bang subdir' ${R}foo ${R}bar//bang//
svn: subversion/libsvn_subr/path.c:391: svn_path_basename: Assertion
`is_canonical (path, len)' failed.
Aborted

$ svn cp -m 'cp foo to bar/bang subdir' ${R}foo ${R}bar/bang//
Committed revision 8.

$ svn up
A bar
A bar/foo
A bar/bang
A bar/bang/foo
Updated to revision 8.

My guess is that some DAV METHODS are accepting multiple or leading
slashes. And some are not. But I haven't dug into the code in depth to
try and track it down.

I'll try to find the time to do that at some point.

-- 
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 Mar 11 08:21:29 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.