Skip to content
Tcl Source Code History Of Ticket 2918610fffffffff
Login

History Of Ticket 2918610fffffffff

Artifacts Associated With Ticket 2918610fffffffff

  1. Ticket change [d0927f230d] (rid 113208) by magv on 2009-12-21 11:28:03:

    1. assignee initialized to: "andreas_kupries"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      Here's a stripped down code snippet:
      
          set root somedir
          exec rm -rf $root
          exec mkdir -p $root
          exec touch $root/x.y
      
          file normalize anything
      
          foreach fn [glob $root/x.y] {
              set ofn [file rootname $fn]
              set fl [open $ofn {WRONLY CREAT}]
              puts $fl "something"
              close $fl
          }
      
          puts [exec ls $root]
      
      I expect this code to put "something" into somedir/x, and then print x and x.y. Instead it puts "something" into somedir/x.y, and prints x.y; somedir/x is not created, even though $ofn is somedir/x.
      
      I tried this code in the following environments:
      
      * FreeBSD/i386 7-STABLE, Tcl 8.4.19 -- works as expected
      * FreeBSD/i386 7-STABLE, Tcl 8.5.8 -- fails as described
      * FreeBSD/i386 7-STABLE, Tcl 8.6-b1 -- fails as described
      * FreeBSD/amd64 8.0-RC2, Tcl 8.5.8 -- fails as described
      * Windows XP, ActiveTcl 8.5.8 -- works as expected
      
      Alexandre Ferrieux was kind enough to test in another environment [1]:
      
      * Windows/MinGW, Tcl 8.5-HEAD -- works as expected
      
      Note that removing the void [file normalize], replacing glob with it's value, or removing foreach loop also makes it work as expected.
      
      I will try to run the code on other systems to see if it's specific to FreeBSD (maybe FreeBSD port patches are to blame).
      
      [1] http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/859e950831fa3e9b
      
    4. foundin initialized to: "obsolete: 8.5.8"
    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: "magv"
    10. subsystem initialized to: "24. Channel Commands"
    11. title initialized to: "Wrong file opened"
    12. type initialized to: "Bug"
  2. Ticket change [c66c4acb46] (rid 121764) by cc_benny on 2009-12-21 21:36:37:

    1. icomment:
      I can confirm the behaviour with these:
      
        Mac OS X 10.4.11, Tcl 8.4.7 -- works
        Mac OS X 10.4.11, Tcl 8.5.7 (MacPorts) -- fails
        Mac OS X 10.4.11, Tcl 8.5.8 (CVS current) -- fails
        Mac OS X 10.4.11, Tcl 8.6b1.1 (CVS current) -- fails
        Linux Ubuntu 9.10 (PPC), Tcl 8.4.19 -- works
        Linux Ubuntu 9.10 (PPC), Tcl 8.5.8 (Source) -- fails
        Linux Ubuntu 9.10 (PPC), Tcl 8.6b1.1 (CVS current) -- fails
      
      Looks to me like the breakage is in the Unix code, introduced
      somewhere in the early 8.5 versions.
      
      
      
    2. login: "cc_benny"
    3. mimetype: "text/plain"
    4. username: "cc_benny"
  3. Ticket change [4db2d047b5] (rid 127093) by dkf on 2009-12-21 22:13:22:

    1. assignee changed to: "dgp"
    2. priority changed to: "9 Immediate"
    3. subsystem changed to: "36. Pathname Management"
  4. Ticket change [5190b90a43] (rid 126154) by ferrieux on 2009-12-22 00:12:41:

    1. icomment:
      I am an absolute ignorant of these things, but single-stepping shows that in the TclPathPart routine, case TCL_PATH_ROOT, when the result object is created, it is built by half-hearted duplication: the PATHOBJ itself is properly duplicated, but its fields are only lazily separated from the original.
      
      Indeed:  normPathPtr is actively split off, because it holds the prime result; similarly the string rep is proprely separated (by T_DupObj) and updated. However, the other fields of the fsDupPtr are left untouched, and they are shared with the original path (argument of [file rootname]): translatedPathPtr and nativePathPtr.
      
      I assume that these should be simply invalidated, though I don't know how (not much time to dive now).
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  5. Ticket change [a04cca5b5e] (rid 96779) by dkf on 2009-12-22 02:13:07:

    1. icomment:
      Just noting that there have been persistent nagging bugs in this area, so something is definitely wrong and nobody's fixed it yet. (Also noting that I've never seriously poked my nose into this area, and don't propose to start now.)
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  6. Ticket change [344ca18c8f] (rid 106737) by ferrieux on 2009-12-22 04:52:03:

    1. icomment:
      Not much progress to report.. except that the dichotomy between the failing and non-failing cases is due to the following test in TclPathPart:
      
      if (TclFSEpochOk(fsPathPtr->filesystemEpoch)
      && (PATHFLAGS(pathPtr) != 0)) {
      
      with the dangerous field-sharing branch exposed when the "if" succeeds.
      I have yet to grok why this happens only on unix. TBC.
      
      
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  7. Ticket change [8952a87704] (rid 132009) by ferrieux on 2009-12-22 17:05:01:

    1. icomment:
      Continuimg at a snail's pace... the offending flag is TCLPATH_APPENDED.
      This flags is set by default when creating a path object with TclNewFSPathObj, so the question becomes, Why on Windows (and on earth) is it reset afterwards ?
      
      
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  8. Ticket change [e47b100f9e] (rid 87959) by ferrieux on 2009-12-22 17:15:47:

    1. icomment:
      Also, it looks like another facet of what happened in 2710920: a brittle PATHFLAGS!=0 code branch.
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  9. Ticket change [4d084ea771] (rid 126995) by ferrieux on 2009-12-22 17:47:29:

    1. icomment:
      
      
      File Added - 356110: rootname.patch
      
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  10. Add attachment "rootname.patch" [8c56d76e71] (rid 127727) by ferrieux on 2009-12-22 17:47:29.

  11. Ticket change [17730417b3] (rid 122497) by ferrieux on 2009-12-22 17:52:18:

    1. icomment:
      Rather than chasing the whereabouts of the various flags (which have a right to exist anyway), I prefer to fix the broken code.
      Attached patch does this by invalidating both the translated and native paths after the duplication.
      I am uneasy about the freeing of the native path though. Currently it is freed only if the fsRecPtr *and* associated freeIntRepProc are not-null, but in any case the nativepathPtr is reset to NULL. So there's a potential leak if either of the above fs-related pointers is null. But I didn't find any example of freeing code doing more. Is it correct ?
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  12. Ticket change [6932d51f46] (rid 103205) by ferrieux on 2009-12-22 17:52:47:

    1. icomment:
      Of course it fixes the local bug and passes the test suite...
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  13. Ticket change [9bae849ce1] (rid 111169) by dkf on 2009-12-22 23:35:12:

    1. icomment:
      It passes the test suite? That's good. The other thing to check is what impact it has on Tcl's startup time with a large auto_path or auto_path of large directories, notably including /usr/lib which is why there's been a problem in the past.
      
      (Trying to remember why we've got all this complex infrastructure here in the first place... :-))
      
      Before commit, the issue identified must be clearly tested for in a self-contained test and you need to check that the test fails before application of the patch and succeeds afterwards. I say this because failing to do that sort of thing has got me in trouble in the past, and VFS path objects are (clearly) very tricky.
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  14. Ticket change [f18420bb7f] (rid 109374) by magv on 2009-12-23 01:02:50:

    1. icomment:
      Thanks, Alexandre. Your patch does wonders (even if it may not be a permanent solution).
      
      
      
    2. login: "magv"
    3. mimetype: "text/plain"
    4. username: "magv"
  15. Ticket change [3a5ccc5d7d] (rid 112552) by dgp on 2009-12-23 03:32:30:

    1. icomment:
      
      Bug introduced between 8.5.2 and 8.5.3
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  16. Ticket change [3de013adde] (rid 121169) by dgp on 2009-12-23 03:56:24:

    1. icomment:
      
      Likely more fallout from the 
      1972879 fix.  
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  17. Ticket change [03d97e608e] (rid 119898) by dgp on 2009-12-23 04:54:19:

    1. icomment:
      
      This appears to be an exposure of an
      existing bug, rather than a new one.
      Appears the PATHFLAGS != 0 and
      portion == TCL_PATH_ROOT branch
      has always been wrong wrong wrong
      yet somehow that combination never
      happened until the changes for 8.5.3.
      
      Alex's patch is one sensible way to fix
      the brokenness.  I want to chase down
      a slightly different fix before commit.
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  18. Ticket change [c3261f3b34] (rid 111611) by dgp on 2009-12-23 04:55:39:

    1. icomment:
      
      I also have a testing script I am using
      to probe this, which I will convert to a
      test before commit (dkf is right!)
      
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  19. Ticket change [e342c7d352] (rid 87764) by dgp on 2010-01-06 01:13:53:

    1. icomment:
      
      The pattern for this bug almost perfectly matches
      2710920.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  20. Ticket change [e0d5e27de6] (rid 87349) by dgp on 2010-01-06 01:51:09:

    1. icomment:
      
      
      File Added - 357792: 2918610.patch
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  21. Add attachment "2918610.patch" [10d65cf507] (rid 95030) by dgp on 2010-01-06 01:51:09.

  22. Ticket change [75dcdffb4c] (rid 105464) by dgp on 2010-01-06 02:00:08:

    1. closedate changed to: "2010-01-05T19:00:08"
    2. closer changed to: "dgp"
    3. icomment:
      
      
      allow_comments - 1
      
      Attached patch committed for 8.5.9 and 8.6b2.
      
      
    4. login: "dgp"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
    8. username: "dgp"