You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Joshua Jensen <jj...@workspacewhiz.com> on 2002/05/25 07:32:20 UTC

Potential issue with svn co file:// with drive letters on Windows machines

I have a local test repository located at e:\svn\repos.

Re: [PATCH] allow local repositories on other windows drives (was: Potential issue with svn co file:// with drive letters on Windows machines)

Posted by Branko Čibej <br...@xbc.nu>.
Ulrich Winter wrote:

>Joshua,
>
>you should first check, if the path contains a drive letter.
>If not, you must not skip the leading slash.
>
>The following patch adds this check and some comments.
>
>Remark:
>As I understand RFC1738, the complete syntax for a file URL with a drive
>letter is
>  file://localhost/e:/some/dir
>so if the host part is ommitted, this leads to the notation with three
>slashes:
>  file:///e:/some/dir
>
>Ok - IE accepts file://e:/some/dir too, but thats the browser being wrong.
>
And anyway, this logic belongs in apr-util, which we should be using for 
URI parsing.

-0 for such a change going into Subversion proper. I'd much rather see a 
patch that switches to usin g the apr_uri_* functions.

>
>--
>Ulrich Winter
>
>
>
>Index: ./subversion/libsvn_ra_local/split_url.c
>===================================================================
>--- ./subversion/libsvn_ra_local/split_url.c
>+++ ./subversion/libsvn_ra_local/split_url.c Sun May 26 22:11:16 2002
>@@ -60,6 +60,35 @@
>       (SVN_ERR_RA_ILLEGAL_URL, 0, NULL, pool,
>        ("svn_ra_local__split_URL: URL contains unsupported hostname"));
>
>+  // Handle system specific path components:
>+  // According to RFC1738 a file URL has the general form
>+  //   file://<host>/<path>
>+  // On Systems whithout a single logical file system namespace, <path> may
>+  // contain special names for drives or volumes, which may be optional,
>+  // meaning "the current drive or volume"
>+  // The interpretation of these special names is system dependent.
>+  //
>+  // Examples:
>+  // VMS:
>+  // DISK$USER:[MY.NOTES]NOTE123456.TXT becomes
>+  //   file://vms.host.edu/disk$user/my/notes/note12345.txt
>+  //
>+  // Windows:
>+  // e:\some\dir becomes one of:
>+  //   file://localhost/e:/some/dir  (absolute path with drive letter on
>specified host)
>+  //   file:///e:/some/dir           (absolute path with drive letter and
>without host)
>+  //   file:///some/dir              (absolute path on current drive
>without host)
>+  // in order to open the repository on WIN32 systems we need the absolute
>path in
>+  // the following form:
>+  //   "/some/dir"                   (implicitly uses the current drive)
>+  //   "e:/some/dir"                 (includes specified drive)
>+
>+#ifdef WIN32
>+  if(strchr(path, ':'))
>+ path++;
>+
>+#endif //WIN32
>+
>   /* Duplicate the URL, starting at the top of the path */
>   url = svn_stringbuf_create ((const char *)path, subpool);
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
>For additional commands, e-mail: dev-help@subversion.tigris.org
>
>  
>


-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

[PATCH] allow local repositories on other windows drives (was: Potential issue with svn co file:// with drive letters on Windows machines)

Posted by Ulrich Winter <ul...@gmx.de>.
Joshua,

you should first check, if the path contains a drive letter.
If not, you must not skip the leading slash.

The following patch adds this check and some comments.

Remark:
As I understand RFC1738, the complete syntax for a file URL with a drive
letter is
  file://localhost/e:/some/dir
so if the host part is ommitted, this leads to the notation with three
slashes:
  file:///e:/some/dir

Ok - IE accepts file://e:/some/dir too, but thats the browser being wrong.

--
Ulrich Winter



Index: ./subversion/libsvn_ra_local/split_url.c
===================================================================
--- ./subversion/libsvn_ra_local/split_url.c
+++ ./subversion/libsvn_ra_local/split_url.c Sun May 26 22:11:16 2002
@@ -60,6 +60,35 @@
       (SVN_ERR_RA_ILLEGAL_URL, 0, NULL, pool,
        ("svn_ra_local__split_URL: URL contains unsupported hostname"));

+  // Handle system specific path components:
+  // According to RFC1738 a file URL has the general form
+  //   file://<host>/<path>
+  // On Systems whithout a single logical file system namespace, <path> may
+  // contain special names for drives or volumes, which may be optional,
+  // meaning "the current drive or volume"
+  // The interpretation of these special names is system dependent.
+  //
+  // Examples:
+  // VMS:
+  // DISK$USER:[MY.NOTES]NOTE123456.TXT becomes
+  //   file://vms.host.edu/disk$user/my/notes/note12345.txt
+  //
+  // Windows:
+  // e:\some\dir becomes one of:
+  //   file://localhost/e:/some/dir  (absolute path with drive letter on
specified host)
+  //   file:///e:/some/dir           (absolute path with drive letter and
without host)
+  //   file:///some/dir              (absolute path on current drive
without host)
+  // in order to open the repository on WIN32 systems we need the absolute
path in
+  // the following form:
+  //   "/some/dir"                   (implicitly uses the current drive)
+  //   "e:/some/dir"                 (includes specified drive)
+
+#ifdef WIN32
+  if(strchr(path, ':'))
+ path++;
+
+#endif //WIN32
+
   /* Duplicate the URL, starting at the top of the path */
   url = svn_stringbuf_create ((const char *)path, subpool);




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Potential issue with svn co file:// with drive letters on Windows machines

Posted by Branko Čibej <br...@xbc.nu>.
Joshua Jensen wrote:

>I have a local test repository located at e:\svn\repos.
>
From a different drive, I try the following:
>
>-------------
>
>[S:\svntest2]svn co file:///e:/svn/repos
>
>svn_error: #21097 : <Couldn't find a repository.>
>  Unable to open an ra_local session to URL
>
>svn_error: #21097 : <Couldn't find a repository.>
>  svn_ra_local__split_URL: Unable to find valid repository
>  
>
This is a known issue. We don't parse the drive part of the URL 
correctly on Windows.

>-------------
>
>All variations yield similar results.  If I do:
>
>[E:\svntest2]svn co file:///svn/repos
>
>The checkout is fine.
>
>My solution was to open libsvn_ra_local/split_url.c and add the #ifdef
>below:
>
>  /* Currently, the only hostnames we are allowing are the empty
>     string and 'localhost' */
>  if ((hostname != path) && (memcmp (hostname, "localhost", 9)))
>    return svn_error_create 
>      (SVN_ERR_RA_ILLEGAL_URL, 0, NULL, pool, 
>       ("svn_ra_local__split_URL: URL contains unsupported hostname"));
>
>#ifdef WIN32
>  path++;
>#endif WIN32
>
No. We should use the URL-parsing code in apr-util, and make sure /that/ 
works correctly. In the meantime, just put the repo on the same drive as 
the working copy.

>I'm sure this isn't a complete solution, but it solves the drive letter
>problem above.  I actually think the command should be:
>
>[S:\svntest2]svn co file://e:/svn/repos
>
>with the removal of the third slash, because this more closely mirrors
>web browser file:// support.
>

All the browsers I've seen put three slashes there, which I think is 
correct (there can be a host name between the second and third slash).

-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org