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

svn fails when trying to checkout a file:/// url with UNC path

From: Alexander Sinyushkin <Alexander.Sinyushkin_at_svnkit.com>
Date: 2007-06-13 15:17:38 CEST

Hello!

Recently we have been reported about troubles that a user had using
SVNKit: he used UNC paths with the file:/// protocol providing them in
this scheme - file:///\server\path. While digging into the trouble I
found that the svn command line client fails to checkout UNC paths in
certain situation, for example, if I provide a repository directory in
this way:

svn co file:///\server\path_to_repos_root\path_in_repos

At the same time svn works just fine if I change the last '\' in the URL
to '/':

svn co file:///\server\path_to_repos_root/path_in_repos

I suppose that the problem may be in that fact that svn encodes all '\'
symbols what results in
file:///%5Cserver%5Cpath_to_repos_root%5Cpath_in_repos. And later
when it tries to compare an entry's url with the repository root url
(for example, in read_entry(...))

   if (entry->repos && entry->url
       && ! svn_path_is_ancestor(entry->repos, entry->url))
     return svn_error_createf(SVN_ERR_WC_CORRUPT, NULL,
                              _("Entry for '%s' has invalid repository "
                                "root"),
                              name ? name : SVN_WC_ENTRY_THIS_DIR);
   MAYBE_DONE;

the function svn_path_is_ancestor() returns false since it expects that
entry->url is the same as entry->repos or has got '/' following the
repos root url segment:

   if (strncmp(path1, path2, path1_len) == 0)
     return path1[path1_len - 1] == '/'
       || (path2[path1_len] == '/' || path2[path1_len] == '\0');

It's not necessary here where svn fails since this check may occur in
some other place. But I hope the idea is clear.

Regards,

----
Alexander Sinyushkin,
TMate Software,
http://svnkit.com/ - Java [Sub]Versioning Library!
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Jun 13 15:18:01 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.