Bug 871 - HUSH: builtin_read does not return >0 when stdin is closed
Summary: HUSH: builtin_read does not return >0 when stdin is closed
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Standard Compliance (show other bugs)
Version: 1.15.x
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-12 11:17 UTC by Mikel Garai
Modified: 2010-01-30 23:15 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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