bug in pipe

<jkock, 2005-04-20>

Is this a bug in pipe?

It happens when -buffering none and putting a string of length > 8192 into a pipe, or with -buffering full and when manually flushing.

 package require Tclx
 pipe out in
 fconfigure $in -buffering none
 fconfigure $out  -blocking 0
 puts -nonewline $in [string repeat H 8193]
 # hangs already here
 puts [read $out]
 close $in 
 close $out

same problem with:

 package require Tclx
 pipe out in
 fconfigure $in -buffering full -buffersize 1000000
 fconfigure $out -blocking 0 -buffering full -buffersize 1000000
 puts -nonewline $in [string repeat H 8193]
 flush $in
 puts [read $out]
 close $in 
 close $out

I am not sure if this still applies but ancient unix (V7 and System 5) had a limit on how many bytes you can put on a pipe before it blocks. IIRC it was 10 * 512 bytes. If this still holds your program blocks in "puts".


LV Note that Tcl bugs should be reported over on http://tcl.sf.net/ , and Tclx bugs on http://tclx.sf.net/ .