Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2026-05-27
13:48
[2a0966cdc9] Give encodings in zip archive priority over past installs. check-in: c98a8d2c27 user: dgp tags: core-9-0-branch
13:46 • Closed ticket [2a0966cdc9]: encoding dirs default values plus 6 other chan... artifact: 49a7bfb7ec user: dgp
13:21 • Ticket [2a0966cdc9]: 3 changes artifact: e57c09e9eb user: dgp
13:18 • Ticket [2a0966cdc9]: 3 changes artifact: 54e29e5079 user: dgp
10:33 • Ticket [2a0966cdc9]: 3 changes artifact: bc999ed83f user: apnadkarni
10:30
Prepend zipfs path to encoding dirs instead of appending (related to bug [2a0966cdc9]) check-in: 06eb2ddf6e user: apnadkarni tags: trunk, main
2026-05-23
14:57 • Ticket [2a0966cdc9] encoding dirs default values status still Open with 3 ... artifact: 9b81f34901 user: apnadkarni
14:48 • Ticket [2a0966cdc9]: 3 changes artifact: 4f2debc983 user: apnadkarni
11:04 • Ticket [2a0966cdc9]: 3 changes artifact: 5ae095e19e user: apnadkarni
2026-05-22
17:29 • Ticket [2a0966cdc9]: 3 changes artifact: ce942addd6 user: dgp
17:09 • Open ticket [2a0966cdc9]. artifact: 748384f3cd user: dgp
17:09 • Ticket [2a0966cdc9]: 5 changes artifact: 125526ef62 user: dgp
10:30 • Closed ticket [2a0966cdc9]. artifact: 4dd000db1a user: apnadkarni
2023-11-23
14:23 • Ticket [2a0966cdc9]: 3 changes artifact: 8029fed23c user: jan.nijtmans
2023-10-25
17:57 • Ticket [2a0966cdc9]: 3 changes artifact: 5fb47ccba6 user: dgp
2023-10-23
19:39 • New ticket [2a0966cdc9]. artifact: 3747465377 user: dgp

[encoding dirs] default values

Closed / Fixed2a0966cdc987a347b2d1d9493994f3129bd50119Created 3 years agoUpdated 189 days ago
Descriptionplain2023-10-23 19:39:43
I noted in Ticket [894e11d7f7] that when tclsh is built with
a zipfs archive containing the Tcl script library, encoding files, etc.
I still see an [encoding dirs] that gives preference to files
installed in the native filesystem over those in the archive.  This is
because I have an old history of installations of older Tcl 9.0a 
snapshots and releases.  The files there are outdated and corrupt and
hilarity ensues.

This ticket opened to examine how [encoding dirs] obtains its default
value and how that should change in the presence of zipfs archives.
Referenced by2
  • c98a8d2c27[2a0966cdc9] Give encodings in zip archive priority over past installs. check-in2026-05-27 13:48:23
  • 06eb2ddf6ePrepend zipfs path to encoding dirs instead of appending (related to bug [2a0966cdc9]) check-in2026-05-27 10:30:08
dgpplain2023-10-25 17:57:18
See commits to branch bug-2a0966cdc9 for developments trying
to bring these matters up to date.
jan.nijtmanswiki2023-11-23 14:23:48

I had a look at this. So far, nice piece of clean-up!

However, for 8.7 I would recommend to keep the stub entries: they are used in TclKit, maybe a few other extensions too. I wouldn't expect a minor Tcl release to remove those entries, even being internal.

I'm sure there's more work to do here ....

apnadkarniplain2026-05-22 10:30:21
Both encoding and library initialization has radically changed, with both bug fixes and TIP's. I don't see this in 9.0 where the zipfs path shows up first.

Closing as part of bug cleanup. Please re-open if you still see zipfs not being given preference.
dgpplain2026-05-22 17:09:21
zipfs is not being given preference.

Tip of 9.0.* development:

$ make runtest
...
% encoding dirs
/home/dgp/x86_64/linuxoldld/lib/tcl9.0/encoding //zipfs:/app/tcl_library/encoding

For this system, this is a regression compared to Tcl 9.0.2.
The regression arrived with the "fix" to bug 87b69745be
in August 2025.

That's as far as I have dug into the details. Will next turn
to examining the breaking patch.
dgp Open ticket [2a0966cdc9]. [History diff]2026-05-22 17:09:40
dgpplain2026-05-22 17:29:29
That approach doesn't look fruitful.

Will try looking directly at the code as it now exists instead.
apnadkarnimarkdown2026-05-23 11:04:26

Don,

TL;DR I think the best approach is (as you suggested) prepend the zipfs directory instead of appending it to the search path. If you think this satisfactory, I'll make the modification. I don't think reverting back to just setting it (overwriting existing value) is advisable.

Let me try to recall and summarize all the context regarding the [encoding dirs] issue.

The original issue was that on macos tkinter was failing because it was not able to find init.tcl. This is connected to encodings because of the encodings directory located under tcl_library.

With respect to why the zipfs path is appended and not set as used to be the case, see my reply apnadkarni added on 2025-11-17 06:13:00: in ticket 6fbabfe166 in response to your query there.

To reiterate, the cause of the failure was that the search path was set (not appended) to the zipfs location. The problem was that on macos, zipfs was either not present or not available even on --enable-zipfs builds. (I'll leave it to macos developers to explain under what circumstances and build configurations this can happen - see Marc and Jan's responses to 6fbabfe166 for starters. The setting of search path overwrote the default macos path that would normally be used resulting in the failure.

Appending instead of setting fixed the above problem.

The other issue with setting/overwriting as I recall was that applications can call Tcl_SetEncodingSearchPath to set the encoding directories search path and it was not clear exactly when this might happen (the second point in the above-mentioned apnadkarni reply link). If that function has been called, it did not seem appropriate to overwrite it.

If we were to revert to setting the directory search path instead of appending to it, someone needs to provide a solution for the above macos failure, either supporting zipfs builds or generating a configure / make error if --enable-zipfs is true, and testing it in appropriate build configurations. I'm not that person. Ignorant about all things mac, don't have a mac and Github CI is very painful way to develop.

One possibility would to append in the case of macos and overwrite on other platforms. I am not in favor of different behaviors on different platforms though.

All the above is reflective of Tcl 9.0.

TIP 732 / 9.1 does not change anything substantial in the above because the initialization of the default path on macos is unchanged.

apnadkarniplain2026-05-23 14:48:25
See if the bug-2a0966cd works better. I prepends the zipfs path so it will be picked if present.
apnadkarniplain2026-05-23 14:57:32
Thinking about it further, I suppose one could also check if the zipfs location exists and if so overwrite instead of appending. Only in 9.1 where zipfs is initialized differently and earlier.

Even if prepending works, I am hesitant to port back to 9.0 in a patch release in any case.

My main difficulty in deciding is an inability to test the tkinter issue on macos.
apnadkarniplain2026-05-27 10:33:02
@dgp, Starting with [06eb2ddf6e], zipfs path is prepended to the encoding dir search path. Leaving this open in case you prefer some other solution (or if prepending does not solve your issue!)
dgpplain2026-05-27 13:18:20
I want to backport to 9.0 for testing and inclusion there.

This patch seems to bring in whole new list utilities?

Why is this so hard?
dgpplain2026-05-27 13:21:30
Checked again and 9.0 branch already has an *IfAbsent() routine.

Will just need to work through the merge conflict.
dgpplain2026-05-27 13:46:55
Confirmed that a backport to 9.0 resolves all the failing tests
in my environment.  That is a good enough outcome for this round.

Profuse thanks for continuing to support this chase.

I will make the commits and merges.
Log in (anonymous is fine) to add a comment.