Artifacts Associated With Ticket 3570244fff
Ticket change [0e6212bed6] (rid 94608) by wastl-nagel on 2012-09-20 21:26:59:
- assignee initialized to: "dkf"
- cmimetype initialized to: "text/plain"
- comment initialized to:
If the last element of a the current path (pwd) is a symbolic link with a trailing slash the command cd .. does not change into the parent directory but stays in the current directory. In addition, when the link target is a relative path containing ".." or "." the pwd after "cd .." may require normalization. Related / possible duplicate of "cd .. from link in Windows confuses Tcl - ID: 3183016" bash> pwd /tmp/test bash> mkdir /tmp/dir bash> ln -sf /tmp/dir link_abs bash> tclsh % cd link_abs % pwd /tmp/test/link_abs % cd .. % pwd ;# ok we are in /tmp (/tmp/test would be also plausible) /tmp % exit bash> ln -sf /tmp/dir/ link_abs_trailing_slash bash> tclsh % cd link_abs_trailing_slash % pwd /tmp/test/link_abs_trailing_slash % cd .. ;# should cd to /tmp (or /tmp/test) % pwd ;# surprise: we stay in same effective directory /tmp/dir % exit bash> ln -sf /tmp/dir link_rel bash> tclsh % cd link_rel % pwd /tmp/test/link_rel % cd .. % pwd ;# ok, but should be normalized /tmp/test/.. % file normalize [pwd] /tmp % exit bash> ln -sf ../dir/ link_rel_trailing_slash bash> tclsh % cd link_rel_trailing_slash % pwd /tmp/test/link_rel_trailing_slash % cd .. % pwd ;# surprise /tmp/dir % exit bash> ln -sf ./link_abs link2link bash> tclsh % cd link2link % pwd /tmp/test/link2link % cd .. ;# now we are in /tmp/test (also ok) % pwd ;# but should be normalized /tmp/test/. % file normalize [pwd] /tmp % puts "$::tcl_patchLevel, $::tcl_platform(os) $::tcl_platform(osVersion)" 8.5.11, Linux 3.2.0-30-generic % exit
- foundin initialized to: "None"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "wastl-nagel"
- subsystem initialized to: "16. Commands A-H"
- title initialized to:
"cd .." behaves wrong if last element in pwd is a symlink
- type initialized to: "Bug"
Ticket change [0f5848204c] (rid 94775) by dkf on 2012-09-21 14:50:50:
- assignee changed to: "dgp"
- foundin changed to: "obsolete: 8.5.11"
- icomment:
Whatever is going on, it's a feature of the file system engine and not the [cd] command itself. I suspect that it depends on what normalization does, and I know that Don Porter has been doing work in that area relatively recently. Is it possible to retest with 8.5.12 or 8.6b3?
- login: "dkf"
- mimetype: "text/plain"
- subsystem changed to: "37. File System"
- username: "dkf"
Ticket change [ca34044436] (rid 122423) by wastl-nagel on 2012-09-21 18:56:51:
- icomment:
Both 8.5.12 and 8.6b3 are affected as well
- login: "wastl-nagel"
- mimetype: "text/plain"
- username: "wastl-nagel"
- icomment:
Ticket change [7c2e96e549] (rid 259328) by serhiy.storchaka on 2026-10-19 18:44:30:
- foundin changed to: "8.6.18, 9.0.5, 9.1.0"
- icomment:
Still present in 8.6, 9.0 and 9.1. As dkf suspected, the cause is in normalization: when ".." follows a link, the link target is used literally ([3577801fff]). Proposed fix in branch [/timeline?r=normalize-dotdot-after-link|normalize-dotdot-after-link]: on Unix <nowiki>[cd ..]</nowiki> now goes to the parent of the link target in all five cases of the report, as <tt>cd -P ..</tt> does. Test filesystem-1.56.
- login: "serhiy.storchaka"
- mimetype: "text/x-fossil-wiki"