Artifacts Associated With Ticket cc1fabcb10f74c40
Ticket change [4b4548b3a8] (rid 234881) by sebres on 2024-11-08 00:13:03:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-wiki"
- comment initialized to:
Example: <code><pre> % file normalize [file join //host/former ../latter/.$tcl_platform(platform)] //host/former/latter/.windows % file join [file dirname //host/former] latter/.$tcl_platform(platform) //host/former/latter/.windows </pre></code> For windows it doesn't switch samba-share (must basically replace former with latter here), so it simply ignores ".." Expected (for both cases): <code><pre> //host/latter/.windows </pre></code> PoC, why it is definitely wrong (and deviates from native FS): <code><pre> % puts [set p [file join //?/d:/ ../c:/windows]]]\t[file normalize $p]\t[file exists $p] //?/d:/../c:/windows] //?/d:/c:/windows 0 % exec cmd /c "IF EXIST $p ECHO YES" YES </pre></code> So it looks like <code><i>Tcl_FSGetTranslatedPath</i></code> function has also the same issue, because of <code><i>file exists</i></code> wrong result (0). - foundin initialized to: "any"
- is_private initialized to: "0"
- login: "sebres"
- priority initialized to: "5 Medium"
- private_contact initialized to: "50e9528765c18296566374b3fde2df942c394efd"
- resolution initialized to: "None"
- severity initialized to: "Severe"
- status initialized to: "Open"
- submitter initialized to: "sebres"
- subsystem initialized to: "36. Pathname Management"
- title initialized to:
windows: file join, file normalize (and/or Tcl_FSGetTranslatedPath) behave incorrect by translation to parent dir for root of samba path
- type initialized to: "Bug"
Ticket change [621fa8a28f] (rid 234882) by oehhar on 2024-11-08 07:30:35:
- icomment:
Great observation, Sebres, as always. Perhaps remove the spurious "]" from the last example: <verbatim> % puts [set p [file join //?/d:/ ../c:/windows]]\t[file normalize $p]\t[file exists $p] //?/d:/../c:/windows //?/d:/c:/windows 0 % exec cmd /c "IF EXIST $p ECHO YES" YES </verbatim> I can confirm on 8.6. Thank you, Harald
- login: "oehhar"
- mimetype: "text/x-fossil-wiki"
- username: "oehhar"
- icomment:
Ticket change [0c7a741186] (rid 234883) by juliannoble2 on 2024-11-08 09:11:21:
- icomment:
For the first case of an ordinary UNC path - I wouldn't expect it to backtrack beyond the share name either using .. or file dirname. - On my windows system it doesn't in either cmd.exe or powershell. For the case of Dos device paths: //./ //?/ //./UNC/server/share //?/UNC/server share - it seems to natively backtrack as far as you like - so as I see it, that's the part that Tcl behaviour doesn't match.
- login: "juliannoble2"
- mimetype: "text/plain"
- icomment:
Ticket change [beb7debf09] (rid 234884) by juliannoble2 on 2024-11-08 09:26:34:
- icomment:
see also: https://core.tcl-lang.org/tcl/tktview/d8f12171564f57c9ed3c In particular the //./ syntax isn't fully supported anyway %file normalize //./c:/windows //./c:windows The //?/ syntax happens to work in this case - but it has other issues as shown in the above ticket. %file normalize //?/c:/windows //?/c:/windows
- login: "juliannoble2"
- mimetype: "text/plain"
- icomment:
Ticket change [50503150d1] (rid 234900) by pooryorick on 2024-11-08 12:01:00:
- icomment:
I believe the current behaviour is the correct before. ".." is a synonym for "the parent directory", and the parent directory of the root directory is the root directory.
- login: "pooryorick"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [a9cba6f931] (rid 234901) by juliannoble2 on 2024-11-08 12:58:55:
- icomment:
>I believe the current behaviour is the correct before. ".." is a synonym for "the parent directory", and the parent directory of the root directory is the root directory. Yes... or in Microsofts terminology - the server and share make up the 'volume' which can't be navigated beyond. ie the following is correct % file dirname //server/share //server share //server/share/etc is an ordinary UNC path with volume //server/share/ //?/UNC/server/share/etc is a device UNC path with volume //?/UNC/server/share/ //?/c:/ is a dos device path with volume //?/c:/ (where technically forwardslashes are backslashes) As an added microsoft twist - the windows API documentation suggests that you can't navigate beyond the volume - but it seems that cmd.exe and powershell may process ".." segments before passing to the API - so some commandline tests can be misleading. Presumably it's the API behaviour we want to be consistent with.
- login: "juliannoble2"
- mimetype: "text/plain"
- icomment:
Ticket change [4b2ab0f9d1] (rid 234902) by juliannoble2 on 2024-11-08 13:00:25:
- icomment:
correction: % file dirname //server/share //server/share
- login: "juliannoble2"
- mimetype: "text/plain"
- icomment:
Ticket change [60d29cd451] (rid 234954) by jan.nijtmans on 2024-11-11 11:58:10:
- icomment:
There is special processing for this case: [https://core.tcl-lang.org/tcl/file?name=generic/tclPathObj.c&ci=95b4578597ed8b7a&ln=179-187] Which means that in the case of UNC paths, the first two components cannot be separated. Conclusion: This is expected behavior.
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [1b0ef5ddd8] (rid 235074) by jan.nijtmans on 2024-11-13 21:58:42:
- assignee changed to: "jan.nijtmans"
- closedate changed to: "2460628.41576876"
- closer changed to: "jan.nijtmans"
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Invalid"
- status changed to: "Closed"