Skip to content
Tcl Source Code History Of Ticket 87b69745be
Login

History Of Ticket 87b69745be

Artifacts Associated With Ticket 87b69745be

  1. Ticket change [45d33afd66] (rid 243613) by apnadkarni on 2025-07-31 05:00:27:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-markdown"
    4. comment initialized to:
      `interp create` results in the currently set search path for encodings to be reset as illustrated below.
      
      ```
      % encoding dirs
      //zipfs:/lib/tcl/tcl_library/encoding
      % encoding dirs [list [encoding dirs] c:/src]
      //zipfs:/lib/tcl/tcl_library/encoding c:/src
      % encoding dirs
      //zipfs:/lib/tcl/tcl_library/encoding c:/src
      % interp create
      interp0
      % encoding dirs
      //zipfs:/lib/tcl/tcl_library/encoding
      ```
      
    5. foundin initialized to: "9.0"
    6. is_private initialized to: "0"
    7. login: "apnadkarni"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "9546e9877f1a8899e25a89082561ee694e7fb402"
    10. resolution initialized to: "None"
    11. severity initialized to: "Minor"
    12. status initialized to: "Open"
    13. submitter initialized to: "apnadkarni"
    14. subsystem initialized to: "- New Builtin Commands"
    15. title initialized to:
      interp creation resets encoding directory search path
      
    16. type initialized to: "Bug"
  2. Ticket change [29ca2d9a94] (rid 243614) by apnadkarni on 2025-07-31 05:16:21:

    1. icomment:
      Looks like the bug was introduced with commit [450d12dac5].
      
    2. login: "apnadkarni"
    3. mimetype: "text/x-fossil-plain"
  3. Ticket change [cc17ddef57] (rid 243830) by apnadkarni on 2025-08-06 13:40:50:

    1. icomment:
      Branch [bug-87b69745be](https://core.tcl-lang.org/tcl/timeline?r=bug-87b69745be) contains a proposed solution to this and other zipfs related encoding bugs that previously contained point fixes.
      
      - It moves locating and mounting of the zipfs containing the tcl library to before creation of any interpreters instead of in the tclInit script. This seems logically correct to me as different interpreters should not be using different directories for `tcl_library` as structures such as file systems and encodings are shared process wide and it does not make sense to have them initialized from different sources. This was already partly achieved by the init flag Sergey introduced to cache the zipfs search but not doing the search at all is more comprehensive.
      
      - It also ensures the file system epoch is only updated if the encoding actually changes. This fixes the issue observed by Sergey (but not logged as a separate ticket) where the file system epoch changes much more frequently than in Tcl 8.6.
      
      Review requested.
      
    2. login: "apnadkarni"
    3. mimetype: "text/x-markdown"
  4. Ticket change [4e601f7307] (rid 243832) by apnadkarni on 2025-08-06 13:53:41:

    1. icomment:
      Reminder to self - need to investigate if wish / Tk have a similar issue.
      
    2. login: "apnadkarni"
    3. mimetype: "text/plain"
  5. Ticket change [1aa7e19a58] (rid 244058) by sebres on 2025-08-13 16:11:19:

    1. icomment:
      After a quick review, I don't entirely agree with the changes in <code>Tcl_SetSystemEncoding</code>, because it may have an issue by moving of <code>Tcl_MutexLock(&encodingMutex)</code> to head of function, which now would cause that due to <code>Tcl_GetEncoding()</code> (which also locks mutex) would do that twice (enters the lock recursively).<br/>
      Note that the mutexes are not necessarily reentrant on all systems, so a recursive locking may be an UB (and may cause a deadlock). Also Tcls documentation says that "the result of locking a mutex twice from the same thread is undefined".
      
      Additionally note that this mutex only protect the hash table of encodings and encoding' refCount, it doesn't really protect static systemEncoding (nor the defaultEncoding) directly. Let alone it'd be still affected by [f2ff05fc84] and co.
      
      Commit [bf62ce24c60c7b8a] shall fix it now.
      
    2. login: "sebres"
    3. mimetype: "text/x-fossil-wiki"
  6. Ticket change [5c15e9e054] (rid 244085) by apnadkarni on 2025-08-13 17:28:33:

    1. icomment:
      @sebres, I am not in agreement with your mods.
      
      First, as I mentioned in the core mailing list, Tcl mutexes are recursive as far as I can tell.
      
      Second, I do not like the comparison of systemEncoding outside of holding the mutex. Globals shared between threads should be accessed under a lock even when reading. While I could probably create a case where that comparison of defaultEncoding and systemEncoding is a race condition, as a matter of principle the safer route is always accessing under a lock instead of proving it is safe.
      
      In fact, looking at the management of systemEncoding without locks led me to create this (unrelated) [ticket](https://core.tcl-lang.org/tcl/tktview/2570123b63) about whether more fixes related to systemEncoding synchronization are needed.
      
      Of course, things are different if Tcl mutexes are not recursive and I misunderstood the manpage.
      
    2. login: "apnadkarni"
    3. mimetype: "text/x-markdown"
  7. Ticket change [08d87ed52b] (rid 244088) by sebres on 2025-08-13 18:26:22:

    1. icomment:
      > Tcl mutexes are recursive as far as I can tell.
      
      Yes, as already confirmed in the core mailing list, you are right and this is indeed reentrant now (changed in 8.7+ after TIP#509).
      
      > I do not like the comparison of systemEncoding outside of holding the mutex.
      
      And if it is compared by locked mutex what would it change?<br/>
      The issue is, as already said, just a conceptual bug and simply a timing thing and may happen with and without lock. In particular of mentioned code, mutex outside of the comparison changes absolutely nothing and in best case may only avoid some unneeded epoch change, however only if system encoding changes continuously across several threads. But then, as already said, you'd have completely different issues (ending with SF).
      
      The only solution would be something like I provided in [f2ff05fc84], or system encoding stored per thread (TSV).
      
      > Globals shared between threads should be accessed under a lock even when reading. 
      
      No. In this particular comparison it doesn't change something, since it is only protection against increase of FS epoch and function simply returns if it is equal now. Few nanoseconds later or earlier it may be different (no matter with or without lock). With already mentioned consequences.
      
      Feel free to revert it (mark may change as mistake branch and reset tags to previous commit), if you don't like it. But I guess in case of possible race condition, you overestimate the lock protection here and underestimate the consequences of conceptual bug (the issue by "wrong" design - thread-safety of the system encoding).
      
    2. login: "sebres"
    3. mimetype: "text/x-markdown"
  8. Ticket change [f639f702d5] (rid 244098) by apnadkarni on 2025-08-14 11:32:48:

    1. icomment:
      @sebres, I'm merging my original code. What you said about not requiring a lock may well be true but except in performance critical paths (this is not one), I prefer to stick with the lock for shared data in the general belief that ensuring access is safe without locks needs careful thought and is prone to errors (possibly even in future when code is modified). Not worth the time spent, imo, to convince oneself there are no race conditions or other effects.
      
    2. login: "apnadkarni"
    3. mimetype: "text/plain"
  9. Ticket change [3f2c8da63a] (rid 244100) by sebres on 2025-08-14 11:47:28:

    1. icomment:
      No problem.
      
      > to convince oneself there are no race conditions or other effects
      
      But there is a race condition issue. The possibility to overwrite a system encoding from every thread (also protected by mutex) will cause that previously set system-encoding, which can be still used by other threads with other functions (see ticket [f2ff05fc84]) may get released (by last reference). And your extra mutex doesn't protect against it at all. Sure, it makes that not more worse as it was, but the lock protection is definitely overestimated...<br/>
      As already said, it is more or less conceptual bug in <code>Tcl_UtfToExternal*</code>, <code>Tcl_ExternalToUtf*</code> and co.
      
    2. login: "sebres"
    3. mimetype: "text/x-fossil-wiki"
  10. Ticket change [153218dfc5] (rid 244101) by apnadkarni on 2025-08-14 13:29:56:

    1. icomment:
      Yes of course. But tracking that as a separate bug that you have already logged (and I duplicated yesterday) as the required solution is much broader (as you also stated). The possibility of race conditions in encoding routines is much greater and has to be fixed.
      
    2. login: "apnadkarni"
    3. mimetype: "text/plain"
  11. Ticket change [0ec3ebc0c1] (rid 244109) by apnadkarni on 2025-08-14 13:47:18:

    1. closedate changed to: "2460902.0745226"
    2. closer changed to: "apnadkarni"
    3. icomment:
      Fixed in [0433b67adc]. Broader thread safety issues with systemEncoding to be addressed separately.
      
    4. login: "apnadkarni"
    5. mimetype: "text/x-fossil-plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
  12. Ticket change [461601b4df] (rid 244284) by jan.nijtmans on 2025-08-18 11:50:40:

    1. closedate changed to: "2460905.99352368"
    2. closer changed to: "jan.nijtmans"
    3. icomment:
      Review remark: indenting in tclEncoding.c is not consistent. All other files in this commit are fine. Fixed [ee22d2717fc9d6c3|here].
      
      Sorry, Ashok.
      
    4. login: "jan.nijtmans"
    5. mimetype: "text/x-fossil-wiki"
  13. Ticket change [32be6af7ca] (rid 244471) by dgp on 2025-08-22 18:19:08:

    1. closedate changed to: "2460910.26328801"
    2. closer changed to: "dgp"
    3. icomment:
      
      On core-9-0-branch, starting with checkin [0433b67adc], I see 114
      failing tests in cmdAH.test and encoding.test.  The first of them is
      
      
      ==== cmdAH-4.3.13.7F.solo.ascii.strict.a encoding convertfrom -profile strict ascii  FAILED
      ==== Contents of test case:
      encoding convertfrom -profile strict ascii 
      ---- Test generated error; Return code was: 1
      ---- Return code should have been one of: 0 2
      ---- errorInfo: unexpected byte sequence starting at index 0: '\x7F'
          while executing
      "encoding convertfrom -profile strict ascii "
          ("uplevel" body line 1)
          invoked from within
      "uplevel 1 $script"
      ---- errorCode: TCL ENCODING ILLEGALSEQUENCE 0
      ==== cmdAH-4.3.13.7F.solo.ascii.strict.a FAILED
      
      
      How can I help unbreak the branch??
      
    4. login: "dgp"
    5. mimetype: "text/plain"
  14. Ticket change [9a899b1494] (rid 244499) by apnadkarni on 2025-08-23 00:55:54:

    1. closedate changed to: "2460910.53882686"
    2. closer changed to: "apnadkarni"
    3. icomment:
      What is the test configuration in which you are seeing errors? Neither my tests not Github CI showed any failures on any platform before I committed.
      
      On the current core-9-0-branch, Github CI still shows no failures and now I re-tested the following combinations on Ubuntu:
      
      ```
      configure
      make test
      make test TESTFLAGS="-singleproc 1"
      
      configure --disable-shared
      make test
      make test TESTFLAGS="-singleproc 1"
      
      configure --disable-zipfs
      make test
      make test TESTFLAGS="-singleproc 1"
      ```
      
      as well as the equivalents on Windows
      
      ```
      nmake /f makefile.vc test
      nmake /f makefile.vc test TESTFLAGS="-singleproc 1"
      nmake /f makefile.vc OPTS=static test
      nmake /f makefile.vc OPTS=static test TESTFLAGS="-singleproc 1"
      nmake /f makefile.vc OPTS=noembed test
      nmake /f makefile.vc OPTS=noembed test TESTFLAGS="-singleproc 1"
      
      ```
      
      None show any failures.
      
      Failing on ASCII input 0x7f is very strange indeed and if it seems to happen only on your system stranger still. Something uninitialized in specific circumstance...?
      
      What platform are you on and what were the specific configure and test options?
      
    4. login: "apnadkarni"
    5. mimetype: "text/plain"
  15. Ticket change [4fd8c2eec4] (rid 244585) by dgp on 2025-08-25 12:56:58:

    1. closedate changed to: "2460913.03956347"
    2. closer changed to: "dgp"
    3. icomment:
      
      Here's a more complete log of my steps to see the failures:
      
      $ uname -a
      Linux spalt.cam.nist.gov 5.15.0-131-generic #141-Ubuntu SMP Fri Jan 10 21:18:28 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
      
      $ mkdir demo-87b697
      $ cd demo-87b697/
      $ fossil open ../tcl.fr 0433b6
      ...
      $ cd unix/
      $ ./configure --disable-shared
      ...
      checking system version... (cached) Linux-5.15.0-131-generic
      ...
      checking for macher... checking for zip... /usr/bin/zip
      Found INFO Zip in environment
      checking for building with zipfs... yes
      ...
      
      $ make
      ...
      $ make tcltest
      ...
      $ make test-tcl TESTFLAGS="-file encoding.test"
      ...
      LD_LIBRARY_PATH=`pwd`:/home/dgp/lib TCLLIBPATH="/home/dgp/fossil/demo-87b697/unix/pkgs" TCL_LIBRARY="" ./tcltest /home/dgp/fossil/demo-87b697/tests/all.tcl -file encoding.test
      Tests running in interp:  /local/tmp/dgp/fossil/demo-87b697/unix/tcltest
      Tests located in:  /local/tmp/dgp/fossil/demo-87b697/tests
      Tests running in:  /local/tmp/dgp/fossil/demo-87b697/unix
      ...
      encoding.test
      
      
      ==== encoding-28.0 all encodings load FAILED
      ==== Contents of test case:
      
      	set string hello
      	foreach name [encoding names] {
      		if {$name ne "unicode"} {
      		    incr count
      		}
      		encoding convertto -profile tcl8 $name $string
      
      		# discard the cached internal representation of Tcl_Encoding
      		# Unfortunately, without this, encoding 2-1 fails.
      		llength $name
      	}
      	return $count
      
      ---- Test generated error; Return code was: 1
      ---- Return code should have been one of: 0 2
      ---- errorInfo: invalid encoding file "tis-620"
          while executing
      "encoding convertto -profile tcl8 $name $string"
          ("foreach" body line 5)
          invoked from within
      "foreach name [encoding names] {
      		if {$name ne "unicode"} {
      		    incr count
      		}
      		encoding convertto -profile tcl8 $name $string
      
      		# discard the cac..."
          ("uplevel" body line 3)
          invoked from within
      "uplevel 1 $script"
      ---- errorCode: TCL LOOKUP ENCODING tis-620
      ==== encoding-28.0 FAILED
      
      
      
      ==== encoding-12.7 cp864 [ecafd8611d] FAILED
      ==== Contents of test case:
      
          encoding convertfrom cp864 \xA7
      
      ---- Test generated error; Return code was: 1
      ---- Return code should have been one of: 0 2
      ---- errorInfo: unexpected byte sequence starting at index 0: '\xA7'
          while executing
      "encoding convertfrom cp864 \xA7"
          ("uplevel" body line 2)
          invoked from within
      "uplevel 1 $script"
      ---- errorCode: TCL ENCODING ILLEGALSEQUENCE 0
      ==== encoding-12.7 FAILED
      
      ...
      
    4. login: "dgp"
    5. mimetype: "text/plain"
  16. Ticket change [a0bce07da8] (rid 244606) by apnadkarni on 2025-08-25 16:25:44:

    1. closedate changed to: "2460913.18454344"
    2. closer changed to: "apnadkarni"
    3. icomment:
      Don,
      
      As seen below your build recipe works fine for me on Ubuntu 20 under WSL. It's more or less identical to one of the configs I tried before but just to be sure.
      
      I do notice one difference though. What is the purpose of the path /home/dgp/lib in your test? Where is it coming from and what does it contain? Can you eliminate that just to eliminate one variation?
      
      ```
      LD_LIBRARY_PATH=`pwd`:/home/dgp/lib ...
      ```
      
      
      ```
      apnadkarni@IO:/mnt/c/src/tcltk/demo-87b697$ uname -a
      Linux IO 6.6.87.2-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC Thu Jun  5 18:30:46 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
      apnadkarni@IO:/mnt/c/src/tcltk/demo-87b697$ cd unix
      apnadkarni@IO:/mnt/c/src/tcltk/demo-87b697/unix$ ./configure --disable-shared
      ...
      checking system version... (cached) Linux-6.6.87.2-microsoft-standard-WSL2
      ...
      checking for macher... checking for zip... /usr/bin/zip
      Found INFO Zip in environment
      checking for building with zipfs... yes
      ...
      apnadkarni@IO:/mnt/c/src/tcltk/demo-87b697/unix$ make
      ...
      apnadkarni@IO:/mnt/c/src/tcltk/demo-87b697/unix$ make tcltest
      ...
      apnadkarni@IO:/mnt/c/src/tcltk/demo-87b697/unix$ make test-tcl TESTFLAGS="-file encoding.test"
      Warning: tclStubInit.c may be out of date.
      Developers may want to run "make genstubs" to regenerate.
      This warning can be safely ignored, do not report as a bug!
      Warning: tclOOScript.h may be out of date.
      Developers may want to run "make genscript" to regenerate.
      This warning can be safely ignored, do not report as a bug!
      LD_LIBRARY_PATH=`pwd`: TCLLIBPATH="/mnt/c/src/tcltk/demo-87b697/unix/pkgs" TCL_LIBRARY="" ./tcltest /mnt/c/src/tcltk/demo-87b697/tests/all.tcl -file encoding.test
      Tests running in interp:  /mnt/c/src/tcltk/demo-87b697/unix/tcltest
      Tests located in:  /mnt/c/src/tcltk/demo-87b697/tests
      Tests running in:  /mnt/c/src/tcltk/demo-87b697/unix
      Temporary files stored in /mnt/c/src/tcltk/demo-87b697/unix
      Test files run in separate interpreters
      Running tests that match:  *
      Skipping test files that match:  l.*.test
      Only running test files that match:  encoding.test
      Tests began at 2025-08-25 21:49:34 IST
      encoding.test
      
      Tests ended at 2025-08-25 21:49:36 IST
      all.tcl:        Total   232     Passed  227     Skipped 5       Failed  0
      Sourced 1 Test Files.
      Number of tests skipped for each constraint:
              4       perf
              1       win
      
      ```
      
    4. login: "apnadkarni"
    5. mimetype: "text/x-markdown"
  17. Ticket change [9193e005df] (rid 244610) by sebres on 2025-08-25 16:48:40:

    1. closedate changed to: "2460913.20046861"
    2. closer changed to: "sebres"
    3. icomment:
      @dgp, does [9338fcde504fb307] changes something in the tests, Don? (I mean if Tcl_GetEncoding fails for whatever reason, and the error would not be silently swallowed now, so could now bring more insides).
      
      By the way, like Ashok, I can't reproduce it on my linux boxes either.
      
    4. login: "sebres"
    5. mimetype: "text/x-fossil-wiki"
  18. Ticket change [9541f3e665] (rid 244611) by dgp on 2025-08-25 18:21:54:

    1. closedate changed to: "2460913.26521149"
    2. closer changed to: "dgp"
    3. icomment:
      
      The checkin now on the tip of the core-9-0-branch doesn't change
      this failure.  No opinion whether or not to keep it.
      
    4. login: "dgp"
    5. mimetype: "text/plain"
  19. Ticket change [3054bc398c] (rid 244612) by dgp on 2025-08-25 18:23:13:

    1. closedate changed to: "2460913.26612602"
    2. icomment:
      
      When I see the failing tests, I am picking up a set of encoding files
      from a very old install, sometime around 2018.
      
    3. login: "dgp"
    4. mimetype: "text/plain"
  20. Ticket change [55f97a4016] (rid 244613) by dgp on 2025-08-25 18:35:25:

    1. closedate changed to: "2460913.27460311"
    2. icomment:
      
      Relative to where I make most Tcl installs, I see
      
        $installDir/lib/tcl9.0/encoding
      
      and the contents of that directory are files placed there in 2018.
      
      That's even earlier than the release of Tcl 9.0a1, so it's some litter
      from pre-release development testing.  I expect that if I clean up my
      disk drive the symptoms will disappear.
      
      Under the Tcl 8 patterns of development, those old files would have
      been overwritten by corrected/updated versions in installs of later
      Tcl 9.0 releases.  But Tcl 9.0 has shifted to placing these files
      in the zip archive, so such installs don't happen anymore.
      
      Starting with [0433b67adc], `make test` is finding and using this litter,
      when it hasn't done so recently before that.  The checkin somehow started
      looking there and using what is found there.  If there's a sound reason
      for that, let's understand it.  If not, lets find and destroy searches
      that might find what can only be wrong answers.
      
    3. login: "dgp"
    4. mimetype: "text/plain"
  21. Ticket change [49673968ca] (rid 244614) by dgp on 2025-08-25 19:54:43:

    1. closedate changed to: "2460913.32967325"
    2. icomment:
      
      Is this the place where the *.enc files get installed after
      a --disable-zipfs build??
      
      Why would my --disable-shared --enable-zipfs build be 
      searching there?
      
    3. login: "dgp"
    4. mimetype: "text/plain"
  22. Ticket change [684c2e00e2] (rid 244616) by sebres on 2025-08-25 22:07:35:

    1. closedate changed to: "2460913.42193701"
    2. closer changed to: "sebres"
    3. icomment:
      Looks like a weird side effect to me.
      
      What would you see with this one (started from build folder):
      
          LD_LIBRARY_PATH=. TCL_LIBRARY="" ./tcltest <<<'puts [encoding dirs]'
      
      In particular do you see some other path before "//zipfs:/app/tcl_library/encoding" (for zipfs) or "${pwd}/../library/encoding" (for build without zipfs)?
      
      Something like:
      
          /usr/local/lib/tcl9.0/encoding ${pwd}/../library/encoding
      
      (or whatever the $installDir you mentioned)?
      
      Strange is, even if I create such directory (and put there some old encodings, e. g. from core-9-0-a1-rc), I cannot reproduce the errors in "encoding.test" anyway (no matter with or without zipfs, disabled shared or not). And I don't know what shall be so different there to force that tests fail.
      
      Moreover in build with zipfs, I see only one path in `encoding dirs` - "//zipfs:/app/tcl_library/encoding" (and since zipfs uses `Tcl_SetEncodingSearchPath` to set search path, it shall be basically sole path only).
      
      By the way, does this one returns 1?
      
          LD_LIBRARY_PATH=. ./tcltest <<<'puts [file exists "//zipfs:/app/tcl_library/encoding"]'
      
    4. login: "sebres"
    5. mimetype: "text/x-fossil-wiki"
  23. Ticket change [2735979429] (rid 244620) by sebres on 2025-08-25 23:08:00:

    1. closedate changed to: "2460913.46389932"
    2. icomment:
      OK, ultimately found that - [9ade301dd7122d21] shall fix it now.
      
      It avoids too earlier search for tcl-library - previously TclZipfsLocateTclLibrary has been invoked before mount of zipfs, so obviously can't find something at time point if TclZipfs_AppHook got called, and since it is called once (and not as before [0433b67adc] for any interpreter), it wouldn't initialize properly (misses a lot of inits, inclusive invocation of TclZipfsInitEncodingDirs).
      
    3. login: "sebres"
    4. mimetype: "text/x-fossil-wiki"
  24. Ticket change [7c5b77cb53] (rid 244622) by apnadkarni on 2025-08-25 23:39:10:

    1. closedate changed to: "2460913.4855415"
    2. closer changed to: "apnadkarni"
    3. icomment:
      As I mentioned on the online meet, I had the feeling Don having reported this with an earlier commit as well. Found it way back in 2023 - https://core.tcl-lang.org/tcl/tktview/894e11d7f73023089a8f. Though on the core-8-branch, essentially the same issue with outdated encodings being found. Not that it matters, but I think this issue has existed for some time and triggers under some specific circumstances.
      
      FWIW, I really do not like Tcl's propensity of "searching" for file locations, whether at build time (headers, libraries), during test, or runtime (scripts, encodings). The current error is an example but not the only one. Many users also run into this issue, finding the wrong headers or libraries while trying to build Tcl.
      
      
      IMO Tcl should never be searching and randomly picking up something that *might* be the right file(s). Look in a fixed location or if not found there have the user specify the location via a configure option, environment variable etc.
      
    4. login: "apnadkarni"
    5. mimetype: "text/plain"
  25. Ticket change [ae5994a07c] (rid 244623) by apnadkarni on 2025-08-26 00:11:07:

    1. closedate changed to: "2460913.50772427"
    2. icomment:
      Sergey, that change seems to break --enable-shared builds. Compare before
      
      ```
      % set tcl_library
      //zipfs:/lib/tcl/tcl_library
      ```
      
      with after
      
      ```
      % set tcl_library
      c:/src/tcltk/main/tcl/library
      ```
      
      Not verified but I think it is because the `TclZipfsLocateTclLibrary()` has been moved inside the
      
      ```
      if (TclZipfs_Mount(NULL, archive, ZIPFS_APP_MOUNT, NULL) == TCL_OK)
      ```
      
      it never checks for zipfs inside the DLL, not the main exe. The test suite does not catch this because of Tcl's "helpful" nature of searching for a tcl library, it searches and finds it in the source repository when it should have really complained of not finding one in a zipfs.
      
      Working on it ...
      
    3. login: "apnadkarni"
    4. mimetype: "text/x-markdown"
  26. Ticket change [35cb4bc59d] (rid 244636) by apnadkarni on 2025-08-26 05:58:34:

    1. closedate changed to: "2460913.74901192"
    2. icomment:
      I have committed a "tactical" fix in the [apn-missing-shlib-zipfs-check](https://core.tcl-lang.org/tcl/timeline?r=apn-missing-shlib-zipfs-check&unhide) branch. Please review.
      
      It's tactical because I think more changes are really needed for a more robust fix. Currently the mounting of zipfs archives and search for `tcl_library` is co-mingled leading to unexpected order of locating files. In principle, zipfs archives present in the exe and the shared library should be mounted first before any searches for the init script or encodings. These changes require a little bigger patch and coming separately.
      
    3. login: "apnadkarni"
    4. mimetype: "text/x-markdown"
  27. Ticket change [00e00fc64d] (rid 244639) by jan.nijtmans on 2025-08-26 08:20:21:

    1. closedate changed to: "2460913.84747463"
    2. closer changed to: "jan.nijtmans"
    3. icomment:
      > Sergey, that change seems to break --enable-shared builds
      
      That - indeed - broke the build. So I moved this commit to Ashok's "apn-missing-shlib-zipfs-check" branch (which also contains a fix for this breakage).
      
      @Sergey, please don't commit directly to core-9-0-branch/trunk unless you are 1000% sure it won't break anything ....
      
      @Ashok, as soon as your fixes are complete, merging it to core-9-0-branch and trunk should be possible without problems.
      
    4. login: "jan.nijtmans"
    5. mimetype: "text/plain"
  28. Ticket change [d91083747c] (rid 244643) by sebres on 2025-08-26 10:37:34:

    1. closedate changed to: "2460913.9427597"
    2. closer changed to: "sebres"
    3. icomment:
      > please don't commit directly to core-9-0-branch/trunk unless you are 1000% sure it won't break anything ....
      
      1000%?! This game can be played by many persons, Jan. Let's count who and how often broke the mainline branches.
      
    4. login: "sebres"
    5. mimetype: "text/x-markdown"
  29. Ticket change [3cc9025858] (rid 244644) by oehhar on 2025-08-26 10:52:06:

    1. closer changed to: "nobody"
    2. login: "oehhar"
    3. mimetype: "text/plain"
    4. status changed to: "Open"
  30. Ticket change [474d003eae] (rid 244667) by apnadkarni on 2025-08-27 07:30:56:

    1. icomment:
      Jan wrote
      
      > @Ashok, as soon as your fixes are complete, merging it to core-9-0-branch and trunk should be possible without problems.
      
      @All
      I think prefer the fix I am working on in the 
      [apn-early-zipfs-mounts](https://core.tcl-lang.org/tcl/timeline?r=apn-early-zipfs-mounts) branch
      rather than [ apn-missing-shlib-zipfs-check](https://core.tcl-lang.org/tcl/timeline?r=apn-missing-shlib-zipfs-check)
      because I really do not like the current intermixing of zipfs mounts and tcl_library searches that results
      in configuration and environment related outcomes. zipfs mounts, just like file system mounts,
      should happen before anything else. it makes reasoning simpler and behaviour more predictable
      and well defined. That branch (still needs to go through CI) changes are a little more widespread so
      needs review so it would be a couple of days.
      
      @Sergey, as an aside...
       I think Jan's comment about working on main trunk was really just an outcome of the last
      online meet where breakage from several direct commits to trunk (not by you! I know this was an
      exception and you almost always work in branches) so it was felt reminders when it happens might
      be useful. Your willingness to dive into bugs, even those not of your making :-), as well as review code is
      hugely appreciated.
      
    2. login: "apnadkarni"
    3. mimetype: "text/x-markdown"
  31. Ticket change [d5f83b1254] (rid 244668) by apnadkarni on 2025-08-27 07:46:36:

    1. icomment:
      @Don, it has been bothering me as to why this issue is exhibited only on your system. I think I have a plausible explanation. It was a combination of 
      
      - the bug introduced by my commit (that Sergey fixed) related to zipfs initialization in static build case, and
      
      - what I would suggest is a misfeature (by design) in the initialization script's use of `pkgconfig scriptdir,runtime`
      
      The init script constructs a list of directories to search for the init.tcl file. One of these is the directory returned by `pkgconfig get scriptdir,runtime`. Because the zipfs failed to locate tcl_library early enough, and the `TCL_LIBRARY` env is not set (by design when running make test with zipfs), the test run lands up using the path returned by `pkgconfig` command. The problem is that the `scriptdir,runtime` value reflects the path **after installation** (presumably the value of `-prefix` or friends). When you ran test-tcl, it was picking up the path where the build would be installed and that path happened to contain the old encodings.
      
      That's my **theory** anyways.
      
      That pkgconfig value is pretty useless as on Windows it never reflects reality and is broken in various scenarios even on Unix, like the one above.
      
    2. login: "apnadkarni"
    3. mimetype: "text/plain"
  32. Ticket change [6e19025658] (rid 244673) by apnadkarni on 2025-08-27 11:21:36:

    1. icomment:
      @dgp, now that it has passed github CI, could you verify the [apn-early-zipfs-mounts](https://core.tcl-lang.org/tcl/timeline?r=apn-early-zipfs-mounts) branch to check that it works correctly in your failure scenario?
      
    2. login: "apnadkarni"
    3. mimetype: "text/x-markdown"
  33. Ticket change [eeaf36d0da] (rid 244835) by apnadkarni on 2025-09-01 03:04:26:

    1. icomment:
      Closing. @dgp, please if you are still experiencing issues, please re-open or log a separate ticket.
      
    2. login: "apnadkarni"
    3. mimetype: "text/plain"
  34. Ticket change [5ada498362] (rid 244836) by apnadkarni on 2025-09-01 03:04:38:

    1. closedate changed to: "2460919.62822543"
    2. closer changed to: "apnadkarni"
    3. login: "apnadkarni"
    4. mimetype: "text/plain"
    5. status changed to: "Closed"
  35. Ticket change [625b252460] (rid 244992) by dgp on 2025-09-02 17:20:27:

    1. closedate changed to: "2460921.22253675"
    2. closer changed to: "dgp"
    3. icomment:
      
      I can confirm that the tests no longer fail on the
      current tip of the core-9-0-branch.  Thanks!
      
      From the comments it looks like there is a remaining
      bug, which I will open in a new ticket.
      
    4. login: "dgp"
    5. mimetype: "text/plain"