Skip to content
Tcl Source Code Artifact [c816081ce5]
Login

Artifact [c816081ce5]

Artifact c816081ce5cff8ed069fee2cdfe9d48c8ace8e430a12c9b4750247cf585e3c43:

Ticket change [c816081ce5] - Ticket [b8f575aa2398b0e4|b8f575aa23] <i>Tcl 9: eof erroneously flagged with not reported encoding read error</i> status still Open with 3 other changes by pooryorick on 2023-01-16 20:31:36.
D 2023-01-16T20:31:36.135
J icomment Jan's\sproposed\sfix,\s[d156af9fb76dd2f4],\schanged\sthe\ssemantics\sof\s[read]\s(and\s[gets]?),\sas\sfollows:\r\n\r\nIn\strunk,\stest\sio-12.9,\s"ReadChars:\smultibyte\schars\ssplit\sFAILED"\sdoes\snot\sresult\sin\san\serror\swhen\sthe\stest\sis\schanged\sso\sthat\sthe\schannel\sis\sconfigured\swith\s-strictencdoing\s1:\r\n\r\n<code><verbatim>\r\ntest\sio-12.9\s{ReadChars:\smultibyte\schars\ssplit}\s-body\s{\r\n\s\s\s\sset\sf\s[open\s$path(test1)\sw]\r\n\s\s\s\sfconfigure\s$f\s-translation\sbinary\r\n\s\s\s\sputs\s-nonewline\s$f\s[string\srepeat\sa\s9]\\xC2\r\n\s\s\s\sclose\s$f\r\n\s\s\s\sset\sf\s[open\s$path(test1)]\r\n\s\s\s\sfconfigure\s$f\s-strictencoding\s1\s-encoding\sutf-8\s-buffersize\s10\r\n\s\s\s\sset\sin\s[read\s$f]\r\n\s\s\s\sclose\s$f\r\n\s\s\s\sscan\s[string\sindex\s$in\send]\s%c\r\n}\s-cleanup\s{\r\n\s\s\s\scatch\s{close\s$f}\r\n}\s-result\s194\r\n</verbatim></code>\r\n\r\nThis\sis\sincorrect.\s\sAn\serror\sshould\sbe\sreturned.\r\n\r\nIf\sa\ssecond\s[read]\sis\sadded,\sit\sreturns\san\serror:\r\n\r\n<code><verbatim>\r\ntest\sio-12.9\s{ReadChars:\smultibyte\schars\ssplit}\s-body\s{\r\n\s\s\s\sset\sf\s[open\s$path(test1)\sw]\r\n\s\s\s\sfconfigure\s$f\s-translation\sbinary\r\n\s\s\s\sputs\s-nonewline\s$f\s[string\srepeat\sa\s9]\\xC2\r\n\s\s\s\sclose\s$f\r\n\s\s\s\sset\sf\s[open\s$path(test1)]\r\n\s\s\s\sfconfigure\s$f\s-strictencoding\s1\s-encoding\sutf-8\s-buffersize\s10\r\n\s\s\s\sset\sin\s[read\s$f]\r\n\s\s\s\sread\s$f\r\n\s\s\s\sclose\s$f\r\n\s\s\s\sscan\s[string\sindex\s$in\send]\s%c\r\n}\s-cleanup\s{\r\n\s\s\s\scatch\s{close\s$f}\r\n}\s-result\s194\r\n</verbatim></code>\r\n\r\n\r\nThis\sis\salso\sincorrect,\sbecause\s[read\s$chan]\sis\sdefined\sto\sread\sall\scharacters\r\nup\suntil\sthe\send\sof\sthe\schannel,\simplying\sthat\sall\sdata\son\sthe\schannel\shas\sbeen\r\ncorrectly\sread.\r\n\r\nThe\sfirst\s[read]\sshould\sreturn\san\serror.
J login pooryorick
J mimetype text/x-fossil-wiki
K b8f575aa2398b0e44b5a037326b9d75037e2da4a
U pooryorick
Z 36411a15e2ac48eed8e5eeee68db4843