From 21e666117b5dda60cbbd1d080272937f4d610dfe Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Sat, 3 Aug 2024 12:30:05 +0000 Subject: Bug [fccb9f322f] - incorrect system encoding with zipfs builds --- generic/tclZipfs.c | 2 ++ tests/unixInit.test | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) 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..099dccb 100644 --- a/tests/unixInit.test +++ b/tests/unixInit.test @@ -100,7 +100,7 @@ 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} -body { set env(LANG) japanese set env(LC_ALL) japanese set f [open "|[list [interpreter]]" w+] -- cgit v0.12 From 97f067908718a69efcb8129decd9ee9fc01ae1bf Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Fri, 9 Aug 2024 13:24:23 +0000 Subject: Tweak unixInit-3.2 to return encoding --- tests/unixInit.test | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/unixInit.test b/tests/unixInit.test index 099dccb..29ff300 100644 --- a/tests/unixInit.test +++ b/tests/unixInit.test @@ -114,12 +114,13 @@ test unixInit-3.2 {TclpSetInitialEncodings} -setup { # reports that newer HP-UX systems report euc-jp like everybody else. lappend validEncodings shiftjis } - expr {$enc ni $validEncodings} + #expr {$enc ni $validEncodings} + set enc } -cleanup { unset -nocomplain env(LANG) env(LC_ALL) catch {set env(LC_ALL) $oldlc_all} catch {set env(TCL_LIBRARY) $oldtcl_library} -} -result 0 +} -result euc-jp test unixInit-4.1 {TclpSetVariables} {unix} { # just make sure they exist -- cgit v0.12 From 4fa03abc95d589e34369a0e05fba9aa1daebce96 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Fri, 9 Aug 2024 15:25:12 +0000 Subject: Also fix the non-zipfs build --- generic/tclInterp.c | 2 +- tests/unixInit.test | 5 ++--- 2 files changed, 3 insertions(+), 4 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/tests/unixInit.test b/tests/unixInit.test index 29ff300..099dccb 100644 --- a/tests/unixInit.test +++ b/tests/unixInit.test @@ -114,13 +114,12 @@ test unixInit-3.2 {TclpSetInitialEncodings} -setup { # reports that newer HP-UX systems report euc-jp like everybody else. lappend validEncodings shiftjis } - #expr {$enc ni $validEncodings} - set enc + expr {$enc ni $validEncodings} } -cleanup { unset -nocomplain env(LANG) env(LC_ALL) catch {set env(LC_ALL) $oldlc_all} catch {set env(TCL_LIBRARY) $oldtcl_library} -} -result euc-jp +} -result 0 test unixInit-4.1 {TclpSetVariables} {unix} { # just make sure they exist -- cgit v0.12 From c03cb200cd9d4b8443ece3431781ae34bbeb8ade Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Sat, 10 Aug 2024 12:55:35 +0000 Subject: Compensate test case for XCode test config --- tests/unixInit.test | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/unixInit.test b/tests/unixInit.test index 099dccb..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} -body { +} -constraints {unix stdio enableUnixInit32} -body { set env(LANG) japanese set env(LC_ALL) japanese set f [open "|[list [interpreter]]" w+] -- cgit v0.12