diff options
| author | apnadkarni <apnmbx-wits@yahoo.com> | 2024-08-11 17:24:58 (GMT) |
|---|---|---|
| committer | apnadkarni <apnmbx-wits@yahoo.com> | 2024-08-11 17:24:58 (GMT) |
| commit | 02237c983a9f4670b5f6ce883e691d00e01ab445 (patch) | |
| tree | 166b12f1718d7a135532856f5c541201e730ba03 | |
| parent | b6fe9b2aa01e1362084085740c77307635c2123e (diff) | |
| parent | c03cb200cd9d4b8443ece3431781ae34bbeb8ade (diff) | |
| download | tcl-02237c983a9f4670b5f6ce883e691d00e01ab445.zip tcl-02237c983a9f4670b5f6ce883e691d00e01ab445.tar.gz tcl-02237c983a9f4670b5f6ce883e691d00e01ab445.tar.bz2 | |
Fix bug [fccb9f322f] - system encoding detection
| -rw-r--r-- | generic/tclInterp.c | 2 | ||||
| -rw-r--r-- | generic/tclZipfs.c | 2 | ||||
| -rw-r--r-- | tests/unixInit.test | 17 |
3 files changed, 19 insertions, 2 deletions
diff --git a/generic/tclInterp.c b/generic/tclInterp.c index 985190f..0abbebd 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -448,7 +448,7 @@ Tcl_Init( " }\n" "}\n" "tclInit", TCL_INDEX_NONE, 0); - + TclpSetInitialEncodings(); end: *names = (*names)->nextPtr; return result; diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index b72abfc..0c964e8 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -4240,6 +4240,8 @@ ScriptLibrarySetup( Tcl_IncrRefCount(searchPathObj); Tcl_SetEncodingSearchPath(searchPathObj); Tcl_DecrRefCount(searchPathObj); + /* Bug [fccb9f322f]. Reinit system encoding after setting search path */ + TclpSetInitialEncodings(); return libDirObj; } diff --git a/tests/unixInit.test b/tests/unixInit.test index 3bbe1e9..899779c 100644 --- a/tests/unixInit.test +++ b/tests/unixInit.test @@ -96,11 +96,26 @@ test unixInit-3.1 {TclpSetInitialEncodings} -constraints { } -cleanup { unset -nocomplain env(LANG) } -match regexp -result {^(iso8859-15?|utf-8)$} + +# unixInit-3.2 depends on the *spawned* [interpreter] being able to locate +# tcl_library without setting of TCL_LIBRARY env. This in turn depends on +# Tcl's "library" directory being under the parent or grandparent of the +# executable directory (the initScript search path in tclInterp.c). +# Thus this constraint. On GiuHub CI, the only time this is not true +# is for the XCode builds. +if {[string match [zipfs root]* [info library]] || + [file isfile [file normalize [file join [info nameofexecutable] .. .. library init.tcl]]] || + [file isfile [file normalize [file join [info nameofexecutable] .. .. .. library init.tcl]]] +} { + tcltest::testConstraint enableUnixInit32 1 +} else { + tcltest::testConstraint enableUnixInit32 0 +} test unixInit-3.2 {TclpSetInitialEncodings} -setup { catch {set oldlc_all $env(LC_ALL)} catch {set oldtcl_library $env(TCL_LIBRARY)} unset -nocomplain env(TCL_LIBRARY) -} -constraints {unix stdio knownBug} -body { +} -constraints {unix stdio enableUnixInit32} -body { set env(LANG) japanese set env(LC_ALL) japanese set f [open "|[list [interpreter]]" w+] |
