Tcl Source Code

View Ticket
Login
Ticket UUID: 9ca87e6286262a62f379dde23604535b0b2dc1d6
Title: Sync fcopy buffers input in ReadChars()
Type: Bug Created on: 2023-04-03 16:32:22
Submitter: pooryorick Assigned to: pooryorick
Subsystem: 25. Channel System Severity: Important
Priority: 5 Medium Last modified: 2023-09-12 13:10:50
Status: Closed Closed by: jan.nijtmans
Resolution: Fixed Closed on: 2023-09-12 13:10:50
Version:
Description:

In [4a7397e0b3] it was reported that sync fcopy buffers input, but the example provided was only for the ReadBytes() case, and only that branch in the code was fixed. The following script shows that the issue still exists for the ReadChars() branch, waiting forever for read() to return:

file delete $path(output)
set f1 [open $path(output) w]
puts -nonewline $f1 {
    chan configure stdin -encoding iso8859-1 -translation lf -buffering none
    fcopy stdin stdout
}
close $f1
set f1 [open "|[list [info nameofexecutable] $path(output)]" r+]
try {
    chan configure $f1  -buffering none
    puts -nonewline $f1 A
    set ch [read $f1 1]
} finally {
    if {$f1 in [chan names]} {
	close $f1
    }
}
lindex $ch

User Comments:
pooryorick added on 2023-04-03 17:15:01:

Failing test in [44d3129b05b73a76]. Fixed in [e08c4afb5351744e].


jan.nijtmans added on 2023-04-04 08:32:44:

Thanks for the fix!

The fix was only committed to trunk, but it should be done in core-8-branch too. Am I right?


pooryorick added on 2023-04-04 16:27:16:

Yes, fixed for core-8-branch in [ab027cdce4].