Tcl Source Code

View Ticket
Login
Ticket UUID: 9ca87e6286262a62f379dde23604535b0b2dc1d6
Title: Sync fcopy buffers input in ReadChars()
Type: Bug Version:
Submitter: pooryorick Created on: 2023-04-03 16:32:22
Subsystem: 25. Channel System Assigned To: pooryorick
Priority: 5 Medium Severity: Important
Status: Closed Last Modified: 2023-09-12 13:10:50
Resolution: Fixed Closed By: jan.nijtmans
    Closed on: 2023-09-12 13:10:50
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-04 16:27:16:

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


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-03 17:15:01:

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