Tcl Source Code

View Ticket
Login
Ticket UUID: fccb9f322f550a37839651d791fed731e2a93d75
Title: unixInit-3.2 fails when encodings dir is in zipfs
Type: Bug Created on: 2022-11-20 22:25:03
Submitter: dgp Assigned to: nobody
Subsystem: 10. Objects Severity: Important
Priority: 5 Medium Last modified: 2024-09-13 12:36:09
Status: Closed Closed by: jan.nijtmans
Resolution: Fixed Closed on: 2024-09-13 12:36:09
Version: 8.7
Description:
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.
User Comments:
jan.nijtmans added on 2022-11-22 19:43:48:

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


apnadkarni added on 2024-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.

apnadkarni added on 2024-08-11 17:27:38:
Fixed in [17c53b7edd]. unixInit-3.2 passes github CI on all platforms.

jan.nijtmans added on 2024-09-13 12:36:09:

Now [c1d2047f90|backported] to 8.7 as well.