Skip to content
Tcl Source Code View Ticket
Login

View Ticket

unixInit-3.2 fails when encodings dir is in zipfs

Closed / Fixedfccb9f322f550a37839651d791fed731e2a93d75Created 4 years agoUpdated 2 years ago
Descriptionplain2022-11-20 22:25:03
Make a fresh build of tclsh.  Set the environment variable LANG to 'japanese'.  Then:

$ cat demo.tcl
puts [encoding dirs]
puts [encoding system]
$ ./tclsh demo.tcl
//zipfs:/app/tcl_library/encoding
iso8859-1

The system encoding should be 'euc-jp'

Next set the environment variable TCL_LIBRARY to point to the script library in
the source code distribution and repeat:

$ ./tclsh demo.tcl              
../library/encoding
euc-jp

Something is going wrong with initialization of the system encoding when the set
of *.enc files is stored in the zipfs filesystem.

The test unixInit-3.2 was supposed to catch problems like this, but the customary
use of the TCL_LIBRARY environment variable when testing was masking
the problem.

I've revised the test unixInit-3.2 to end the masking of the problem.
Referenced by9
  • f3d1ce6b6cTicket [63941fee4f] interp create resets the system encoding set by encoding system status still Open with 6 other changes ticket2026-10-17 06:46:04
  • d4ba36ed13Ticket [63941fee4f] interp create resets the system encoding set by encoding system status still Open with 3 other changes ticket2026-10-16 22:12:02
  • 03512d66ebFix [63941fee4f]: interp create reset the system encoding set by [encoding system]. TclpSetInitialEncodings() sets the encoding from the environment only until it succeeds, so the calls from Tcl_Init() added for [fccb9f322f] no longer reset it. check-in2026-10-16 22:09:50
  • abeb195484Re-fix [fccb9f322f]. Also eliminate bumping of file system epoch on every interp creation introduced in Tcl 9 check-in2025-08-03 17:42:28
  • c1d2047f90(Backport): Fix bug [fccb9f322f] - system encoding detection check-in2024-09-13 12:16:56
  • 1cd8653ce0merge [17c53b7edd516003]: Fix bug [fccb9f322f] - system encoding detection. check-in2024-08-31 00:47:11
  • 17c53b7eddFix bug [fccb9f322f] - system encoding detection check-in2024-08-11 17:24:58
  • 0f14007371Bug [fccb9f322f] - incorrect system encoding with zipfs builds check-in2024-08-03 12:30:05
  • 6850595984Mark unixInit-3.2 as "knownBug". See [fccb9f322f] check-in2022-11-21 23:52:36
jan.nijtmanswiki2022-11-22 19:43:48

This is a dup of [75ecc0e6cb9899bf], which already has a branch with a proposed fix

apnadkarniplain2024-08-03 12:36:08
I am not sure this is a dup of  [75ecc0e6cb9899bf] as this seems to be specific to use of zipfs.

Proposed fix is [bug-fccb9f322f]. Review requested.

I am not entirely comfortable with this fix as it corrects the system encoding after it has already been initialized. On the other hand, doing it right in the first place would require the zipfs initialization to be moved up in the init sequence, something I am even more hesitant to do as init of Tcl is a big mystery to me.

So my take is that this is not an ideal fix, but better than the current state.
apnadkarniplain2024-08-11 17:27:38
Fixed in [17c53b7edd]. unixInit-3.2 passes github CI on all platforms.
jan.nijtmanswiki2024-09-13 12:36:09

Now [backported] to 8.7 as well.

Log in (anonymous is fine) to add a comment.