[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: Strange behavior for 'read -n 5'
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2012-01-15 22:04:29
Message-ID: CAK1hOcMi-uYRDAhhN-xyew_P9wiQTb9r915VzJfy7GdKQU1w7w () mail ! gmail ! com
[Download RAW message or body]

On Mon, Jan 9, 2012 at 5:02 PM, Daniel Baluta <dbaluta@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
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic