Strange behavior for 'read -n 5'
Denys Vlasenko
vda.linux at googlemail.com
Sun Jan 15 22:04:29 UTC 2012
On Mon, Jan 9, 2012 at 5:02 PM, Daniel Baluta <dbaluta at ixiacom.com> wrote:
> Hello,
>
> We have some problems with read command on latest busybox
> version.
>
> $ read -n 5
> 123456
>
> This command isn't returning after the fifth character. It seems
> that it is blocked in the poll call. Only after the 6th character
> is entered, the poll returns.
>
> poll([{fd=0, events=POLLIN}], 1, -1) = 1 ([{fd=0, revents=POLLIN}])
> read(0, "1", 1) = 1
> poll([{fd=0, events=POLLIN}], 1, -1) = 1 ([{fd=0, revents=POLLIN}])
> read(0, "2", 1) = 1
> poll([{fd=0, events=POLLIN}], 1, -1
>
>
> This is very likely to be caused by the latest patches:
> * hush: use SA_RESTARTed signal handlers across read. (10c0131a)
> * hush: make read builtin interruptible. (80542bad)
Excellent analysis!
The fix is in git now:
http://git.busybox.net/busybox/commit/?id=7ce209b9d4f6053b7e6d07dec66e382bc3614c35
--
vda
More information about the busybox
mailing list