View Ticket
Not logged in
Ticket UUID: cdd360438de1331b83874fbb70f4e0d22fdbae79
Title: Fossil does not handle absolute paths without disk drives in Windows.
Status: Fixed Type: Code_Defect
Severity: Minor Priority:
Subsystem: Resolution: Fixed
Last Modified: 2009-09-13 16:21:13
Version Found In: 713b8be852
Description & Comments:
Attempt #1 to open a repository in Windows:
e:\source\c\fossil>fossil open \Source\Repositories\fossil.fsl
fossil: repository does not exist or is in an unreadable directory: E:/Source/C/fossil/Source/Repositories/fossil.fsl
Attempt #2:
e:\source\c\fossil>fossil open E:\Source\Repositories\fossil.fsl
BUILD.txt
COPYRIGHT-GPL2.txt
Makefile
Makefile.w32
art/CollRev1.dia
art/CollRev2.dia
art/CollRev3.dia
art/CollRev4.dia
art/branching.odp
.
.
.
It bizarrely assumes that a path with an opening backslash is relative to the current path instead of relative to the drive root like it should. It seems fossil only recognizes a full path specification if it includes device names. This is a Bad Idea. It makes me wonder how it handles UNC or UNCW paths as well:
\\Computer\SharedFolder\Path\To\Destination\File
\\?\UNC\Computer\SharedFolder\Path\To\Destination\File.
(I have no way of testing that at the moment as the Windows machine I'm using is not on a network with any other Windows machines.)

drh added on 2009-09-13 11:47:15:
I think that the following patch may be sufficient to fix this:

--- src/file.c
+++ src/file.c
@@ -244,10 +244,11 @@
 ** Convert /A/../ to just /
 */
 void file_canonical_name(const char *zOrigName, Blob *pOut){
   if( zOrigName[0]=='/'
 #ifdef __MINGW32__
+      || zOrigName[0]=='\\'
       || (strlen(zOrigName)>3 && zOrigName[1]==':'
            && (zOrigName[2]=='\\' || zOrigName[2]=='/'))
 #endif
   ){
     blob_set(pOut, zOrigName);

I will strive to boot up a copy of windows this afternoon and try it out. In the meantime, a work-around might be to use forward slashes ("/") instead of backslashes ("\") in the pathname, at least for the first character of an absolute pathname.


drh added on 2009-09-13 16:21:13:
The patch shown above turns out to work. Fixed by check-in 42bf80978d9740dbac8c762033348fbb1da9b0de.