Bug 871

Summary: HUSH: builtin_read does not return >0 when stdin is closed
Product: Busybox Reporter: Mikel Garai <m.garai>
Component: Standard ComplianceAssignee: unassigned
Status: RESOLVED FIXED    
Severity: normal CC: busybox-cvs
Priority: P5    
Version: 1.15.x   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

Description Mikel Garai 2010-01-12 11:17:28 UTC
In code like this:

cat XXX | ( while read a b c; do
   echo $a
   echo $b
  ....
done )

the current implementation leads to a infinite loop.

The patch attached in the bug 865 ( https://bugs.busybox.net/show_bug.cgi?id=865 ) fixes this bug.
Comment 1 Denys Vlasenko 2010-01-12 11:57:36 UTC
I propose adapting and reusing (sharing) ash's readcmd() code. It is a bit more work, but ash's read is well debugged and supports options like timeouts, max chars and so on.
Comment 2 Denys Vlasenko 2010-01-12 23:23:20 UTC
Fix is committed to git.
Comment 3 Mikel Garai 2010-01-13 11:13:59 UTC
Thanks!
Comment 4 Denys Vlasenko 2010-01-30 23:15:24 UTC
Fixed in 1.16.0