Skip to content
Tcl Source Code History Of Ticket a47641a031
Login

History Of Ticket a47641a031

Artifacts Associated With Ticket a47641a031

  1. Ticket change [6006ac81c0] (rid 144873) by danckaert on 2016-02-08 11:23:20:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      On Windows, [file normalize] gives inconsistent results through junctions:
      
      % cd c:/tmp
      % file link foo ../windows
      ../windows
      % file readlink foo
      C:\Windows
      % file normalize [file join foo bar] ;# this gives the wrong result
      C:/Tmp/foo/bar
      % file join foo bar
      foo/bar
      % file normalize foo/bar ;# this gives the right result
      C:/Windows/bar
      
      There are already several tickets about junctions in Windows (mostly related to access rights), but his one seems more severe since it involves an EIAS violation.
      
    5. foundin initialized to: "8.6.4"
    6. is_private initialized to: "0"
    7. login: "danckaert"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "0e8530048dde617c952863a9160a09c72773c1ee"
    10. resolution initialized to: "None"
    11. severity initialized to: "Important"
    12. status initialized to: "Open"
    13. submitter initialized to: "danckaert"
    14. subsystem initialized to: "36. Pathname Management"
    15. title initialized to:
      File normalize is inconsistent with Windows junctions
      
    16. type initialized to: "Bug"
  2. Ticket change [b064665573] (rid 144981) by apnadkarni on 2016-02-25 03:39:47:

    1. icomment:
      Same issue is also demonstrated by tests filesystem-1.{3,4}. Also this issue does not show up if the link already existed (as opposed to being created within the same process via file link).
      
    2. login: "apnadkarni"
    3. mimetype: "text/plain"
    4. title changed to:
      File normalize is inconsistent with Windows junctions (filesystem-1.3,4)
      
  3. Ticket change [acf4b3f93b] (rid 144982) by apnadkarni on 2016-02-25 06:06:59:

    1. icomment:
      There is a bunch of code in the execution path [file normalize [file join ...]]
      that I find dubious but the root cause of this specific bug is the special
      optimization case in TclJoinPath starting at line 874 in tclPathObj.c
      
      After a bunch of checks to ensure certain criteria are met (for example,
      only two elements to join), the special case code calls TclNewFSPathObj
      to construct the joined path and returns the result. However, as
      indicated by the comments and reflected in the code, TclNewFSPathObj
      expects the first argument to be an *absolute* path which in the test
      case example, it isn't. The returned object's FsPath intrep is essentially
      marked as not needing normalization (the TCLPATH_NEEDNORM flag is not set)
      though the cwdPtr field is NOT normalized or absolute.
      
      Later, Tcl_FSGetNormalizedPath skips over the crucial normalization code
      thinking the FsPath intrep is already normalized. Hence the wrong result.
      
      Options are
      
      - disable the TclJoinPath special case. I've tested that this fixes both
      the reported bug as well as the failing test cases. I don't know how
      much of a performance impact this has in real life. The time command
      does not show any appreciable difference for the file join itself.
      
      - disable the optimized code only for Windows since it appears this bug
      does not manifest on Unix. I'm actually curious as to why since it is common
      code. My guess is that the file system specific call for normalization does
      something different on Unix.
      
      - Add a check to special case criteria that the first argument is indeed
      an absolute path.
      
      In addition to fixing file join as above, the question also arises whether
      file normalize should even use cached results at all. IMHO semantics of
      normalize should require a visit to the filesystem at the time the call
      is made. Otherwise, how does it take into account a link created (possibly
      even from outside the program itself) after a path is cached?
      
      For the same reason, one might argue that the file link command should
      increment the global file system epoch when a link is created to
      invalidate all cached representations. This is exactly as what is
      done when env(HOME) changes or file system mounts are changed
      (see comments in tclioutil.c)
      
    2. login: "apnadkarni"
    3. mimetype: "text/plain"
  4. Ticket change [f133748457] (rid 144983) by apnadkarni on 2016-02-25 06:07:37:

    1. assignee changed to: "dgp"
    2. icomment: "Assigned to dgp for comments."
    3. login: "apnadkarni"
    4. mimetype: "text/plain"
  5. Ticket change [cf5e87e5ce] (rid 144990) by dgp on 2016-02-25 13:58:31:

    1. icomment:
      
      I'm happy that someone is looking into this.
      
      On the analysis, I cannot comment on the fine
      details, but all the general comments are correct.
      
      I wonder if this other issue is playing any role
      
      http://core.tcl.tk/tcl/tktview?name=961646
      
      I have no confidence that I will be able to confirm
      any of the fixes proposed under time pressure in a
      way that I'm sure will not risk breaking something
      at least as important as what it fixes.  Thus, I
      would postpone pushing this fix to trunk until 
      after the 8.6.5 release.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  6. Ticket change [8646014971] (rid 147617) by apnadkarni on 2016-07-08 08:02:30:

    1. icomment:
      Fixed in core-8-6-branch by check-in [a47641a031]. TclJoinPath will now only use the optimized branch if the first argument is an absolute path as required by TclNewFSPath.
      
      I'm still of the opinion that file normalize should not use cached information and that file link should update the file system epoch for the reasons listed in a previous comment. But those are separate issues from this fix.
      
    2. login: "apnadkarni"
    3. mimetype: "text/x-fossil-wiki"
  7. Ticket change [d128f5f619] (rid 147727) by apnadkarni on 2016-07-09 11:05:13:

    1. closedate changed to: "2457578.96196645"
    2. closer changed to: "apnadkarni"
    3. foundin changed to: "8.6.5"
    4. login: "apnadkarni"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"