Bugs item #10627, was opened at 2007-05-06 10:41
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=10627&group_id=426

Category: None
Group: 1.8.x
Status: Open
Resolution: None
Priority: 3
Submitted By: Pawel Pokrywka (cog)
Assigned to: Nobody (None)
Summary: Short read with readline, popen and timeout - first byte of the line disappears

Initial Comment:
Hello,

Popen()'ed subprocess writes "123\n" on stdout, while readline() or gets() sometimes returns "23\n". Readline() is invoked from timeout() block.

Lower timeout is, bug probability increases.

I have attached proof of concept code which clearly demonstrate the bug. I tested the bug with the following compilations:

- ruby 1.8.4 (2005-12-24) [i486-linux] (Ubuntu 6.10) - bug exists
- ruby 1.8.5 (2006-08-25) [i486-linux] (Ubuntu 6.10) - bug exists
- ruby 1.9.0 (2006-06-08) [i486-linux] (Ubuntu 7.04) - bug fixed


----------------------------------------------------------------------

>Comment By: Pawel Pokrywka (cog)
Date: 2007-05-06 10:44

Message:
print-lines script follows:
#!/bin/sh
while :
do
echo $@
sleep 0.03
done


----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=10627&group_id=426