Artifacts Associated With Ticket 961646
Ticket change [4ee3dfbbb1] (rid 125727) by dgp on 2004-05-27 15:36:01:
- assignee initialized to: "vincentdarley"
- cmimetype initialized to: "text/plain"
- comment initialized to:
% glob * file % open noSuchDir/../file couldn't open "noSuchDir/../file": no such file or directory % open [file normalize noSuchDir/../file] file3 Here [file normalize] converts "noSuchDir/../file" to "file", but and [open] on one fails, the other succeeds. I think of [file normalize] giving me the preferred name among many names for one file. Here it is convering a string that names no file into one that does name a file. This suggests that /../ interpretation is Tcl_Filesystem-specific and ought to be done in each Tcl_Filesystem's Tcl_FSNormalizePathProc rather than in the core FS layer.
- foundin initialized to: "obsolete: 8.5a2"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "dgp"
- subsystem initialized to: "37. File System"
- title initialized to: "[file normalize] changes file reference"
- type initialized to: "Bug"
Ticket change [10cc19a700] (rid 95023) by vincentdarley on 2004-05-27 22:50:02:
- icomment:
Logged In: YES user_id=32170 An alternative interpretation is that 'open' on Unix has a bug. For example: % file exists noSuchDir/../file 1 works just fine. (And on Windows your 'open' example works fine too)
- login: "vincentdarley"
- mimetype: "text/plain"
- username: "vincentdarley"
- icomment:
Ticket change [a069cb4935] (rid 96809) by dgp on 2004-05-28 00:14:55:
- icomment:
Logged In: YES user_id=80530 % file exists noSuchDir/../file 0 % file exists [file normalize noSuchDir/../file] 1 The interpretation of /../ is filesystem dependent.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [c6759887ae] (rid 121772) by vincentdarley on 2004-06-02 21:27:58:
- icomment:
Logged In: YES user_id=32170 I still tend to think this illustrates a bug in Tcl somewhere, since the above behaviour is not expected. I now think it's due to some of the fs-optimization that was performed. In particular, I think it's due to the 'if' block here in NativeCreateNativeRep: if (tsdPtr->cwdClientData != NULL) { /* The cwd is native */ validPathPtr = Tcl_FSGetTranslatedPath(NULL, pathPtr); } else { /* Make sure the normalized path is set */ validPathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr); Tcl_IncrRefCount(validPathPtr); } try making that 'if (0)' and see if the problem goes away. -- Now, it's a separate issue as to what the desired behaviour is. I see arguments for both approaches, really. In particular, if, as you suggest the /../ interpretation is moved to the filesystem-specific layer (vastly complicating all filesystems), what behaviour should 'file normalize' have in this case? How should 'file normalize' be documented? - login: "vincentdarley"
- mimetype: "text/plain"
- username: "vincentdarley"
- icomment:
Ticket change [7d6d4fc87a] (rid 164255) by dgp on 2018-06-28 19:06:41:
- assignee changed to: "aku"
- closer changed to: "nobody"
- comment changed to:
% glob * file % open noSuchDir/../file couldn't open "noSuchDir/../file": no such file or directory % open [file normalize noSuchDir/../file] file3 Here [file normalize] converts "noSuchDir/../file" to "file", but and [open] on one fails, the other succeeds. I think of [file normalize] giving me the preferred name among many names for one file. Here it is convering a string that names no file into one that does name a file. This suggests that /../ interpretation is Tcl_Filesystem-specific and ought to be done in each Tcl_Filesystem's Tcl_FSNormalizePathProc rather than in the core FS layer.
- icomment:
The rules of path resolution by linux system calls are spelled out here. http://man7.org/linux/man-pages/man7/path_resolution.7.html According to them, Tcl needs to pass the "/.." substrings of things like /path/to/../foobar to the system calls intact to get them processed properly against the state of the filesystem. Lexical shortening due to "normalization" or for whatever other reasons lurk in the core of Tcl filesystem operations to pass /path/foobar instead are incorrect. That is, they create a system where the meaning of paths in Tcl are demonstrably inconsistent with the meaning of paths on the platform itself. If Tcl really does mean to intentionally be different, that needs a lot more explanation and spelling out. I think it's just a broken implementation.
- login: "dgp"
- mimetype: "text/plain"
- severity changed to: "Minor"