<i>Tcl 9: Cannot write large strings to file</i> status still Closed with 4 other changes
by
.
D 2023-04-23T23:44:35.680
J closedate 2460058.48930185
J icomment [Sorry,\shadn't\schanged\sfrom\splain\stext\sto\slinks\sonly.\sFor\syour\sconvenience\shere\sthe\ssame\sagain:]\r\n\r\nThe\sfix\sfor[3d01d51bc4]\swith\scommit\s[186e4d9317]\sdidn't\sreally\sfix\sthe\sproblem.\r\n\r\nLook\sat\s\r\n[https://core.tcl-lang.org/tcl/artifact?udc=1&ln=4262-4278&name=ce11265346dd36a3]\r\n\r\nIn\sthat\sloop\sthe\sscr\spointer\swill\snot\sbe\sincrementend.\sWhich\smeans\sthat\safter\severy\sINT_MAX\sbytes\swritten\sit\sstarts\sover\sfrom\sthe\sstart\sof\sthe\sstring\sinstead\sof\scontinuing.\sThis\sexplains\sthe\soutput\sof\sthe\sexamples\sgiven\sso\sfar.\r\n\r\nAn\sobvious\sfix\sis\r\n\r\nhttps://core.tcl-lang.org/tcl/artifact?udc=1&ln=4276&name=abf0f8ddf7519a1f\r\n\r\nBut\sthis\sraises\sthe\squestion\swhat\sWriteChars(chanPtr,\ssrc,\schunkSize)\sdoes\sif\sthe\schunkSize\sends\sin\sthe\smiddle\sof\sa\smultibyte\schar?\r\n\r\nSome\sanswers\sto\sthat\squestion\sdoesn't\slook\spromissing\s(need\sa\sTcl\s9\stcltest\sto\srun\sthis\sexample\sscript):\r\n\r\nset\ss\s[testbigdata\sstring\s0x7FFFFFFE]\r\n#\sThe\scharacter\sto\sappend\sin\sthe\snext\sline\sis\sEM\sDASH,\s\r\n#\scode\spoint\s0x2014\s(decimal\s8212,\sUTF-8\s#xE2\s#x80\s#x94,\s\r\nappend\ss\s—\r\nset\sfd\s[open\sout.txt\sw+]\r\nputs\s$fd\s$s\r\nclose\s$fd\r\n\r\nIf\sI\srun\sthis\s(on\sdebian)\sI\sget:\r\n\r\nerror\swriting\s"file6":\sinvalid\sor\sincomplete\smultibyte\sor\swide\scharacter\r\n\s\s\s\swhile\sexecuting\r\n"puts\s$fd\s$s"
J login pointsman
J mimetype text/x-fossil-plain
K 3d01d51bc45cf7c53938d23f7ac4a364341a878d
U pointsman
Z 319d88a64a0024cf2bc5886c1030fb69