Overview
| Artifact ID: | 8ee743a66c6b5aff0de3253d179b556bb73beec3 |
|---|---|
| Ticket: | da7c079978cb3183731147d2e6a555794416a5bf
FS strips root '/' from FS root volume "zvfs:/" |
| User & Date: | anonymous on 2017-06-08 02:32:33 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
I've been attempting to create a vfs which is totally isolated from the native fs. I've set the Tcl_Filesystem to "zvfs" and, following the example in tclTest.c, my FSListVolumesProc returns a single Tcl_Obj "zvfs:/". Using a minimal Tcl_Filesystem with only ListVolumes, Chdir and PathInFilesystem (which always returns TCL_OK unless the path is a windows path), I find that Tcl is stripping the root '/' from what it considers the cwd. % cd zvfs:/ % cd dir % pwd zvfs:/dir % cd .. % pwd zvfs: For windows paths, the '/' is not stripped from, say, "C:/". The routine TclFSNormalizeAbsolutePath in tclPathObj.c is the culprit. It is taking "zvfs:/dir/.." and: /* * Have '..' so need to skip previous directory. */ if (retVal == NULL) { const char *path = TclGetString(pathPtr); retVal = Tcl_NewStringObj(path, dirSep - path); Tcl_IncrRefCount(retVal); } removes the '/' leaving "zvfs:". Toward the bottom of the function there is specific windows code to restore the '/': /* * Ensure a windows drive like C:/ has a trailing separator. */ if (tclPlatform == TCL_PLATFORM_WINDOWS) { int len; const char *path = Tcl_GetStringFromObj(retVal, &len); if (len == 2 && path[0] != 0 && path[1] == ':') { if (Tcl_IsShared(retVal)) { TclDecrRefCount(retVal); retVal = Tcl_DuplicateObj(retVal); Tcl_IncrRefCount(retVal); } Tcl_AppendToObj(retVal, "/", 1); } } Either: a) I don't understand what FSListVolumesProc is supposed to return b) If "zvfs:/" is OK, then perhaps it's not meant to be equivalent to a windows "drive" even though TclpObjListVolumes() in win/tclWinFCmd.c returns "C:/", etc. c) Tcl does not consider fs volumes other than windows I don't know if this is a bug or what. How is a fs supposed to tell Tcl about a volume prefix? Must a fs "mount" its directory structure somewhere within '/' for both unix and windows? I wish there was a reference fs or the documentation were more detailed. - foundin changed to: "8.6.6"
- is_private changed to: "0"
- login: "anonymous"
- priority changed to: "5 Medium"
- private_contact changed to: "b8731723488b9adb1562242d803fdc609ed3d701"
- resolution changed to: "None"
- severity changed to: "Important"
- status changed to: "Open"
- submitter changed to: "anonymous"
- subsystem changed to: "37. File System"
- title changed to: "FS strips root '/' from FS root volume "zvfs:/""
- type changed to: "Bug"