9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
|
removeFile $scriptFile
} -body {
set fd [open |[list [info nameofexecutable] $scriptFile r+]]
fconfigure $fd -encoding utf-8 -profile replace
read $fd
} -result a\uFFFDb
# 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
}
cleanupTests
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9967
9968
9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
|
removeFile $scriptFile
} -body {
set fd [open |[list [info nameofexecutable] $scriptFile r+]]
fconfigure $fd -encoding utf-8 -profile replace
read $fd
} -result a\uFFFDb
test bug-73bb42fb-1 {
Non-blocking+buffer size+encoding error panic - TCL bug 73bb42fb
} -setup {
writeFile $path(test1) binary \xD6[string repeat _ 20]
} -body {
set fd [open $path(test1)]
fconfigure $fd -blocking 0 -buffersize 10 -translation lf -eofchar {}
list [catch {read $fd 1} e d] [dict get $d -code] [dict get $d -errorcode] [tell $fd]
} -cleanup {
close $fd
} -result {1 1 {POSIX EILSEQ {invalid or incomplete multibyte or wide character}} 0}
test bug-73bb42fb-2 {
Non-blocking+buffer size+encoding error panic - TCL bug 73bb42fb
} -setup {
writeFile $path(test1) binary X\xD6[string repeat _ 20]
} -body {
# Verify single char read does not fail
set fd [open $path(test1)]
fconfigure $fd -blocking 0 -buffersize 10 -translation lf -eofchar {}
read $fd 1
} -cleanup {
close $fd
} -result X
test bug-73bb43fb-3 {
Non-blocking+buffer size+encoding error panic - TCL bug 73bb42fb
} -setup {
writeFile $path(test1) binary X\xD6[string repeat _ 20]
} -body {
# Verify valid data returned before error generated
set fd [open $path(test1)]
fconfigure $fd -blocking 0 -buffersize 10 -translation lf -eofchar {}
set result {}
lappend result [read $fd]
lappend result [tell $fd]
lappend result [catch {read $fd} e d] [dict get $d -code] [dict get $d -errorcode] [tell $fd]
} -cleanup {
close $fd
} -result {X 1 1 1 {POSIX EILSEQ {invalid or incomplete multibyte or wide character}} 1}
test bug-73bb43fb-4 {
Non-blocking+buffer size+encoding error panic - TCL bug 73bb42fb
} -body {
# Original Sergey's repro script from ticket. Only check no crash
set f [open [list | [info nameofexecutable] << {fconfigure stdout -translation binary; puts \xD6[string repeat _ 20]}]]
fconfigure $f -blocking 0 -buffersize 10 -translation lf -eofchar {}
catch {while {![string length [set d [read $f]]]} {after 10}} e d
close $f
list [dict get $d -code] [dict get $d -errorcode]
} -result {1 {POSIX EILSEQ {invalid or incomplete multibyte or wide character}}}
# 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
}
cleanupTests
|