<i>TclInitSubsystems issues: the sporadic lack of encodings</i> status still Open with 4 other changes
by
.
D 2018-05-31T13:50:42.959
J comment Set\sthe\ssystem\sencoding\svia\senvironment/locale\sfailed\ssometimes\sdependent\sof\sthe\ssystem\sconstellation\s(distribution\sand/or\ssome\senv-settings).\r\n\r\nWho\ssaw\salready\sthe\stest\s"unixInit-3.2"\sfailed?\s:)\r\n\r\nThis\scumulates\sfrom\stwo\sactual\sissues:\r\n\r\n1.\ssetlocale\s(called\sfrom\sTclpInitPlatform)\smay\soverwrite\senvironment\s"LANG"\s(to\s"C"),\sso\sthe\stry\ssearching\sof\scurrent\sencoding\slater\sin\sTcl_GetEncodingNameFromEnvironment\s<b>will\sfailback\sto\s"C"</b>\s(so\sthe\scall\sof\s"setlocale"\stakes\splace\s<b>too\searly</b>\sin\ssome\scases,\sresp.\sget\sinitial\senvironment\svia\sgetenv("LANG")\s<b>too\slate</b>);\r\n\r\n2.\ssecond\sthing\swhich\scan\shappen,\sif\s1st\sissue\swith\s"setlocale"\sgets\srepaired,\swould\sbe\sthe\sfact,\sthat\sTcl_GetEncodingSearchPath\s(called\sfrom\sTclpSetInitialEncodings/Tcl_SetSystemEncoding)\smay\sreturn\s""\s<b>before\sstill\sany\sinterpreter\sinstance\screated</b>\s(and\sit\sis\sso\sif\sTclpInitPlatform\scalled).<br/>\r\nIn\sthis\scase\ssetting\sof\ssomething\sother\sas\salready\savailable\ssystem-encodings\sgoing\sto\s"C"\s(iso8859-1),\sbecause\sthe\sload\sof\sencoding\ssimply\sfails.<br/>\r\nThe\sreason\sfor\sthis\strouble\sis\sthe\swrong\svalue\sreturned\sby\scallback\sTclpInitLibraryPath.<br/>\sBut\slater\s(after\sfirst\sinterp\sgoing\screated)\sthe\sinit.tcl\s(as\swell\sas\sthe\scounterpart\sscript\shard-coded\sin\sTcl_Init)\swill\sindirectly\scall\sTcl_SetEncodingSearchPath\sto\sthe\sproper\svalue\s(after\stcl_library\scorrect\sresolved\sand\sTclGetProcessGlobalValue(&libraryPath)\sreturns\scorrect\svalue)\sand\sthen\sthe\sload\sof\sthe\ssame\sencoding\sworks.\r\n\r\nFollowing\scode\scan\sillustrate\sthis\sbehavior:\r\n<pre\sstyle="padding-left:10pt"><code>\r\n$\secho\s'puts\s==[encoding\ssystem];\sencoding\ssystem\seuc-jp;\sputs\s==[encoding\ssystem]'\s|\sLANG=japanese\s./tclsh\r\n\r\n==iso8859-1\r\n==euc-jp\r\n</code></pre>\r\nBut\ssetting\sof\sproper\stcl_library\senv-variable\sresolves\sit:\r\n<pre\sstyle="padding-left:10pt"><code>\r\n$\secho\s'puts\s==[encoding\ssystem];\sencoding\ssystem\seuc-jp;\sputs\s==[encoding\ssystem]'\s|\sLANG=japanese\sTCL_LIBRARY=../library\s./tclsh\r\n\r\n==euc-jp\r\n==euc-jp\r\n</code></pre>\r\n\r\nI\ssaw\sit\salready\stoo\soften,\sbut\sfollowing\scases\sare\saffected\sespecially:\r\n\r\n-\susage\sof\sportable-like\s(not\sinstalled)\stcl's\sinstance\sor\stcl-ed\sapplications\s(where\sTCL_LIBRARY\senvironment\svariable\sdoes\snot\sset\sby\sstart);\r\n\r\n-\scall\sof\sother\stcl-instance\sfrom\stcl-app\svia\s[open\s"|\ssome-tcl-app"]\sinside\sthe\stcl-interpterer\swith\schanged\senvironment\s(LC_...\sresp.\sLANG\sare\schanged);\r\n\r\n-\scall\sof\stcl\sfrom\sdevelopment\senvironment\s(also\snot\sistalled),\slike\sthis:\r\n<pre\sstyle="padding-left:10pt"><code>\r\n$\scd\s~projects/tcl8.6/unix\r\n$\sLD_LIBRARY_PATH=.\s./tclsh\s../tests/all.tcl\s-file\s'*unixInit*'\s-match\s'*unixInit-3.2*'\r\n\r\n...\r\n====\sunixInit-3.2\sTclpSetInitialEncodings\sFAILED\r\n...\r\n----\sResult\swas:\r\n1\r\n----\sResult\sshould\shave\sbeen\s(exact\smatching):\r\n0\r\n====\sunixInit-3.2\sFAILED\r\n...\r\n</code></pre>\r\n\r\nI've\slocalized\sthe\s"wrong"\splaces\sand\swill\stry\sto\sfix\sit\ssoon.<br/>\r\nWiP.
J icomment The\sbranch\s"<a\shref="https://core.tcl.tk/tcl/timeline?r=fix-initsubsystem-75ecc0e6cb9899bf">fix-initsubsystem-75ecc0e6cb9899bf</a>"\sprovides\sa\sfix\sfor\sthis\sticket\s(for\s8.6th).\r\n\r\nAll\stests\spassed\son\smy\sreference\ssystems\s(*nix\sas\swell\sas\swindows).
J login sebres
J mimetype text/x-fossil-wiki
K 75ecc0e6cb9899bff0fa9e22a10a76b0c244c0a1
U sebres
Z d693167801b914360980d2704ad53ea7