Skip to content
Tcl Source Code History Of Ticket 4d3f213029
Login

History Of Ticket 4d3f213029

Artifacts Associated With Ticket 4d3f213029

  1. Ticket change [85e7c0bfd6] (rid 213855) by jrioux on 2023-04-25 14:17:21:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-plain"
    4. comment initialized to:
      Tested on Ubuntu 22.04 with Tcl 8.6.12 and VFS 1.4.2
      
      The following minimal example causes tclsh to segfault (infinite recursion). Expected was that no segmentation fault occurs.
      
      package require vfs
      set testdir directory_for_testing_will_be_deleted
      set testdir_abs [file join [pwd] $testdir]
      file mkdir $testdir
      cd $testdir
      puts "Current working dir: [pwd]"
      file delete $testdir_abs
      puts "Current working dir: [pwd]"
      puts "File exists: [file exists .]"
      
    5. foundin initialized to: "8.6"
    6. is_private initialized to: "0"
    7. login: "jrioux"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "0dfacf32a543c83cbee5c8884538a221b52e85a7"
    10. resolution initialized to: "None"
    11. severity initialized to: "Important"
    12. status initialized to: "Open"
    13. submitter initialized to: "jrioux"
    14. subsystem initialized to: "37. File System"
    15. title initialized to:
      VFS support causes infinite recursion during 'file exists' if working directory has been removed
      
    16. type initialized to: "Bug"
  2. Ticket change [5d4ec96fe8] (rid 213856) by oehhar on 2023-04-25 14:33:54:

    1. icomment:
      Julien,
      
      thanks for the bug report.
      Why is this related to vfs? The issue only happens with the package require vfs? But you only work on real files, do you?
      
      On  TCL8.6.13 32bit on Windows 10 64 bit, the example does not work, as one may not delete the working directory. By adding "-force" to delete, it works. But the pwd is adjusted, to point to a present folder.
      
      Here is an interactive session:
      
      <verbatim>
      % set testdir directory_for_testing_will_be_deleted
      directory_for_testing_will_be_deleted
      % set testdir_abs [file join [pwd] $testdir]
      C:/myprograms/tcl8.6/bin/directory_for_testing_will_be_deleted
      % file mkdir $testdir
      % cd $testdir
      % pwd
      C:/myprograms/tcl8.6/bin/directory_for_testing_will_be_deleted
      % file delete -force $testdir_abs
      % pwd
      C:/myprograms/tcl8.6/bin
      % file exists .
      1
      </verbatim>
      
      Maybe, you also post the output of your program.
      
      Take care,
      Harald
      
    2. login: "oehhar"
    3. mimetype: "text/x-fossil-wiki"
    4. username: "oehhar"
  3. Ticket change [c667ecbe65] (rid 213857) by jrioux on 2023-04-25 15:21:52:

    1. icomment:
      Yes the bug is only reproducible with "package require vfs" and most likely only on linux.
      
      Here the program output running in gdb:
      
      (gdb) r
      Starting program: /usr/bin/tclsh
      warning: Error disabling address space randomization: Operation not permitted
      [Thread debugging using libthread_db enabled]
      Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
      % package require vfs
      1.4.2
      % set testdir directory_for_testing_will_be_deleted
      directory_for_testing_will_be_deleted
      % set testdir_abs [file join [pwd] $testdir]
      /directory_for_testing_will_be_deleted
      % file mkdir $testdir
      % cd $testdir
      % puts "Current working dir: [pwd]"
      Current working dir: /directory_for_testing_will_be_deleted
      % file delete $testdir_abs
      % puts "Current working dir: [pwd]"
      Current working dir:
      % puts "File exists: [file exists .]"
      
      Program received signal SIGSEGV, Segmentation fault.
      0x00007fb74877effd in Tcl_FSGetCwd () from /lib/x86_64-linux-gnu/libtcl8.6.so
      (gdb) bt
      #0  0x00007fb74877effd in Tcl_FSGetCwd () from /lib/x86_64-linux-gnu/libtcl8.6.so
      #1  0x00007fb748796099 in Tcl_FSGetNormalizedPath () from /lib/x86_64-linux-gnu/libtcl8.6.so
      #2  0x00007fb748002c36 in ?? () from /usr/lib/tcltk/x86_64-linux-gnu/vfs1.4.2/libvfs1.4.2.so
      #3  0x00007fb748780b9e in Tcl_FSGetFileSystemForPath () from /lib/x86_64-linux-gnu/libtcl8.6.so
      #4  0x00007fb74877f1c9 in Tcl_FSGetCwd () from /lib/x86_64-linux-gnu/libtcl8.6.so
      #5  0x00007fb748796099 in Tcl_FSGetNormalizedPath () from /lib/x86_64-linux-gnu/libtcl8.6.so
      #6  0x00007fb748002c36 in ?? () from /usr/lib/tcltk/x86_64-linux-gnu/vfs1.4.2/libvfs1.4.2.so
      #7  0x00007fb748780b9e in Tcl_FSGetFileSystemForPath () from /lib/x86_64-linux-gnu/libtcl8.6.so
      #8  0x00007fb74877f1c9 in Tcl_FSGetCwd () from /lib/x86_64-linux-gnu/libtcl8.6.so
      #9  0x00007fb748796099 in Tcl_FSGetNormalizedPath () from /lib/x86_64-linux-gnu/libtcl8.6.so
      #10 0x00007fb748002c36 in ?? () from /usr/lib/tcltk/x86_64-linux-gnu/vfs1.4.2/libvfs1.4.2.so
      #11 0x00007fb748780b9e in Tcl_FSGetFileSystemForPath () from /lib/x86_64-linux-gnu/libtcl8.6.so
      #12 0x00007fb74877f1c9 in Tcl_FSGetCwd () from /lib/x86_64-linux-gnu/libtcl8.6.so
      #13 0x00007fb748796099 in Tcl_FSGetNormalizedPath () from /lib/x86_64-linux-gnu/libtcl8.6.so
      #14 0x00007fb748002c36 in ?? () from /usr/lib/tcltk/x86_64-linux-gnu/vfs1.4.2/libvfs1.4.2.so
      #15 0x00007fb748780b9e in Tcl_FSGetFileSystemForPath () from /lib/x86_64-linux-gnu/libtcl8.6.so
      #16 0x00007fb74877f1c9 in Tcl_FSGetCwd () from /lib/x86_64-linux-gnu/libtcl8.6.so
      #17 0x00007fb748796099 in Tcl_FSGetNormalizedPath () from /lib/x86_64-linux-gnu/libtcl8.6.so
      #18 0x00007fb748002c36 in ?? () from /usr/lib/tcltk/x86_64-linux-gnu/vfs1.4.2/libvfs1.4.2.so
      #19 0x00007fb748780b9e in Tcl_FSGetFileSystemForPath () from /lib/x86_64-linux-gnu/libtcl8.6.so
      #20 0x00007fb74877f1c9 in Tcl_FSGetCwd () from /lib/x86_64-linux-gnu/libtcl8.6.so
      #21 0x00007fb748796099 in Tcl_FSGetNormalizedPath () from /lib/x86_64-linux-gnu/libtcl8.6.so
      #22 0x00007fb748002c36 in ?? () from /usr/lib/tcltk/x86_64-linux-gnu/vfs1.4.2/libvfs1.4.2.so
      #23 0x00007fb748780b9e in Tcl_FSGetFileSystemForPath () from /lib/x86_64-linux-gnu/libtcl8.6.so
      #24 0x00007fb74877f1c9 in Tcl_FSGetCwd () from /lib/x86_64-linux-gnu/libtcl8.6.so
      #25 0x00007fb748796099 in Tcl_FSGetNormalizedPath () from /lib/x86_64-linux-gnu/libtcl8.6.so
      #26 0x00007fb748002c36 in ?? () from /usr/lib/tcltk/x86_64-linux-gnu/vfs1.4.2/libvfs1.4.2.so
      #27 0x00007fb748780b9e in Tcl_FSGetFileSystemForPath () from /lib/x86_64-linux-gnu/libtcl8.6.so
      #28 0x00007fb74877f1c9 in Tcl_FSGetCwd () from /lib/x86_64-linux-gnu/libtcl8.6.so
      #29 0x00007fb748796099 in Tcl_FSGetNormalizedPath () from /lib/x86_64-linux-gnu/libtcl8.6.so
      #30 0x00007fb748002c36 in ?? () from /usr/lib/tcltk/x86_64-linux-gnu/vfs1.4.2/libvfs1.4.2.so
      #31 0x00007fb748780b9e in Tcl_FSGetFileSystemForPath () from /lib/x86_64-linux-gnu/libtcl8.6.so
      --Type <RET> for more, q to quit, c to continue without paging--
      
      The ?? in the stack trace should be VfsPathInFilesystem if I am not mistaken.
      
    2. login: "jrioux"
    3. mimetype: "text/plain"
    4. username: "jrioux"
  4. Ticket change [104a0eeb21] (rid 257956) by serhiy.storchaka on 2026-10-13 20:09:22:

    1. foundin changed to: "9.0.5, 9.1.0"
    2. icomment:
      Not specific to VFS: in 9.0 and 9.1, where zipfs is always registered, the
      example crashes without any extension. When a script sourced with a relative
      path is evaluated after its current directory was deleted, its path cannot be
      normalized, and <code>TclEvalEx()</code> then jumped to its error handler
      before parsing a command, using uninitialized data and corrupting memory.
      
      Proposed fix in branch [/timeline?r=eval-cwd-deleted|eval-cwd-deleted]: use
      the path as is, it is only used for location information. The script then
      gets the usual errors for <code>pwd</code> and <code>glob</code>. Test
      source-9.1.
      
    3. login: "serhiy.storchaka"
    4. mimetype: "text/x-fossil-wiki"
  5. Ticket change [10f979df60] (rid 261456) by oehhar on 2026-11-12 08:50:53:

    1. icomment:
      Fix effective on Windows. Will merge after CI due to "perhaps Linux only" given in the description.
      
      Thanks for all,
      Harald
      
    2. login: "oehhar"
    3. mimetype: "text/x-fossil-wiki"
    4. username: "oehhar"
  6. Ticket change [247d8450c9] (rid 261681) by oehhar on 2026-11-14 17:13:27:

    1. icomment:
      Jan, you have removed the "core-eval-cwd-deleted".
      I did not find the CI run.
      Is it me?
      I have reset this tag.
      
      Sorry,
      Harald
      
    2. login: "oehhar"
    3. mimetype: "text/x-fossil-wiki"
    4. username: "oehhar"
  7. Ticket change [3f3b637d7f] (rid 261733) by oehhar on 2026-11-15 17:01:42:

    1. icomment:
      CI fully clean.
      Will merge tomorrow.
      
      Thanks for all,
      Harald
      
    2. login: "oehhar"
    3. mimetype: "text/x-fossil-wiki"
    4. username: "oehhar"
  8. Ticket change [14ce21c8af] (rid 261759) by oehhar on 2026-11-16 10:43:04:

    1. closedate changed to: "2461360.9465757175"
    2. closer changed to: "oehhar"
    3. icomment:
      Merged to:
      
         *   main [ca784f17]
         *   core-9-0-branch [3dce1740]
         *   core-8-6-branch [57b7358a]
      
      Bug closed.
      
      Thanks for all,
      Harald
      
    4. login: "oehhar"
    5. mimetype: "text/x-fossil-wiki"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
    8. username: "oehhar"
  9. Ticket change [2e96d01314] (rid 262036) by jan.nijtmans on 2026-11-23 11:13:55:

    1. assignee changed to: "jan.nijtmans"
    2. closer changed to: "nobody"
    3. icomment:
      In core-8-6-branch:
      <pre>
      ==== source-9.1 source with relative path after the current directory was deleted FAILED
      ==== Contents of test case:
          exec sh -c {cd "$1" && exec "$2" cwddeleted.tcl} sh $dir [interpreter]
      ---- Result was:
      0 0 1
      ---- Result should have been (exact matching):
      1 0 0
      ==== source-9.1 FAILED
      ==== source-9.2 source with relative path after the current directory was deleted and [pwd] failed FAILED
      ==== Contents of test case:
          exec sh -c {cd "$1" && exec "$2" cwddeleted.tcl} sh $dir [interpreter]
      ---- Result was:
      0 0 1
      ---- Result should have been (exact matching):
      1 0 0
      ==== source-9.2 FAILED]
      </pre>
      
      Bisecting shows:
      <pre>
      $ fossil bisect chart
        1 BAD     2026-11-23 10:36:57 d762377fa4ac44aa
        5 BAD     2026-11-18 18:22:08 69c0fdc481139395
        6 BAD     2026-11-16 12:56:57 e0480cc1b4b52da3
        8 BAD     2026-11-16 10:41:26 57b7358a875cc03d CURRENT
        7 GOOD    2026-11-15 14:13:37 b74cee085c1a5620
        4 GOOD    2026-11-11 13:50:19 41c90339a6ece4d8
        3 GOOD    2026-10-28 11:09:51 f53502fa2a30da96
        2 GOOD    2026-10-01 22:44:48 342ab733c3d5998b
      </pre>
      
      This points to exactly the commit where this fix was merged to core-8-6-branch (while core-9-0-branch and trunk appear to be OK). Somehow this solution doesn't work on 8.6.
      
      I'm having a look at it, but if someone else has an idea why this doesn't work on 8.6, but works fine with 9.x, please come forward!
      
    4. login: "jan.nijtmans"
    5. mimetype: "text/x-fossil-wiki"
    6. status changed to: "Pending"
  10. Ticket change [218733cacb] (rid 262037) by jan.nijtmans on 2026-11-23 11:18:52:

    1. icomment:
      Since the patch doesn't appear to have any negative side-effect, I marked the source-9.1 and 9.2 testcases as 'knownBug' for now.
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
  11. Ticket change [2ddd3893ee] (rid 262040) by jan.nijtmans on 2026-11-23 12:05:58:

    1. icomment:
      I suspect that some additional bug-fix, already done in 9.0, needs a backport for those 2 testcases to work .....
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
  12. Ticket change [1b6add3f04] (rid 262042) by serhiy.storchaka on 2026-11-23 13:32:24:

    1. icomment:
      The missing fix is [82a62c58b9] for [e2698b94b1] (Tcl_FSChdir crashes after seteuid), which is only in 9.0 and main. In 8.6, when getcwd() fails, Tcl_FSGetCwd() sets the error message but continues, and turns the NULL into an empty path, so <code>pwd</code> returns "" and <code>file exists .</code> returns 1. Backport in branch [/timeline?r=getcwd-failure-8-6|getcwd-failure-8-6] (by hand, the comments differ), with the knownBug marks removed: source-9.1 and 9.2 pass, and so does the whole test suite.
      
    2. login: "serhiy.storchaka"
    3. mimetype: "text/x-fossil-wiki"
  13. Ticket change [49b32db7f6] (rid 262053) by jan.nijtmans on 2026-11-23 23:13:12:

    1. closedate changed to: "2461368.467503611"
    2. closer changed to: "jan.nijtmans"
    3. icomment: "Thanks, that was it! Everything OK now!"
    4. login: "jan.nijtmans"
    5. mimetype: "text/x-fossil-wiki"
    6. status changed to: "Closed"