<i>synchronous [read] with -strictencoding does not produce an error on invalid input</i>.
by
.
D 2022-12-27T21:51:54.447
J assignee nobody
J closer nobody
J cmimetype text/x-fossil-wiki
J comment In\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 is_private 0
J login pooryorick
J priority 5\sMedium
J resolution None
J severity Severe
J status Open
J submitter pooryorick
J subsystem 25.\sChannel\sSystem
J title synchronous\s[read]\swith\s-strictencoding\sdoes\snot\sproduce\san\serror\son\sinvalid\sinput
J type Bug
K 1bedc53c8cb878f0bf2a9b65c83b9e481f85fb47
U pooryorick
Z 2e91512c6ceed99a93f7870a6105e761