Skip to content
Tcl Source Code History Of Ticket 3570244fff
Login

History Of Ticket 3570244fff

Artifacts Associated With Ticket 3570244fff

  1. Ticket change [0e6212bed6] (rid 94608) by wastl-nagel on 2012-09-20 21:26:59:

    1. assignee initialized to: "dkf"
    2. cmimetype initialized to: "text/plain"
    3. 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
      
      
    4. foundin initialized to: "None"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "wastl-nagel"
    10. subsystem initialized to: "16. Commands A-H"
    11. title initialized to:
      "cd .." behaves wrong if last element in pwd is a symlink
      
    12. type initialized to: "Bug"
  2. Ticket change [0f5848204c] (rid 94775) by dkf on 2012-09-21 14:50:50:

    1. assignee changed to: "dgp"
    2. foundin changed to: "obsolete: 8.5.11"
    3. 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?
      
      
    4. login: "dkf"
    5. mimetype: "text/plain"
    6. subsystem changed to: "37. File System"
    7. username: "dkf"
  3. Ticket change [ca34044436] (rid 122423) by wastl-nagel on 2012-09-21 18:56:51:

    1. icomment:
      Both 8.5.12 and 8.6b3 are affected as well
      
      
    2. login: "wastl-nagel"
    3. mimetype: "text/plain"
    4. username: "wastl-nagel"
  4. Ticket change [7c2e96e549] (rid 259328) by serhiy.storchaka on 2026-10-19 18:44:30:

    1. foundin changed to: "8.6.18, 9.0.5, 9.1.0"
    2. 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.
      
    3. login: "serhiy.storchaka"
    4. mimetype: "text/x-fossil-wiki"