10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
|
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
set f [open [list | [info nameofexecutable] << {fconfigure stdout -translation binary; puts \xD6[string repeat _ 20]}]]
fconfigure $f -profile strict -blocking 0 -buffersize 10 -translation lf -eofchar {}
list [catch { read_blocked $f } e d] $e [dict getd $d -code ""] [dict getd $d -errorcode ""]
} -cleanup {
if {$f ne ""} {close $f}
} -match glob -result {1 {error reading *} 1 {POSIX EILSEQ {invalid or incomplete multibyte or wide character}}}
test io-bug-73bb43fb-4 {
Non-blocking+buffer size+encoding error panic - TCL bug 73bb42fb.
(PoC) Delay between bytes of single utf-8 char doesn't cause encoding error with profile strict.
} -setup {
set f ""
} -body {
set f [open [list | [info nameofexecutable] << {
fconfigure stdout -translation binary
puts -nonewline "START-"; flush stdout
foreach {ch} [split [encoding convertto \u30B3] ""] {; # 3 bytes E3 82 B3
puts -nonewline $ch; flush stdout; if {$ch ne "\xB3"} {after 100}
}
puts -nonewline "-DONE"; flush stdout
}]]
fconfigure $f -profile strict -blocking 0 -buffersize 10 -translation lf -eofchar {}
list [catch { read_blocked $f 12 } e d] $e [dict getd $d -code ""] [dict getd $d -errorcode ""]
} -cleanup {
if {$f ne ""} {close $f}
} -result "0 START-\u30B3-DONE 0 {}"
rename read_blocked {}
# cleanup
foreach file [list fooBar longfile script2 output test1 pipe my_script \
test2 test3 cat stdout kyrillic.txt utf8-fcopy.txt utf8-rp.txt] {
removeFile $file
}
|