seq | head: embedded vs desktop

Denys Vlasenko vda.linux at googlemail.com
Sun Oct 17 10:40:50 UTC 2010


On Friday 15 October 2010 19:46, busybox at eehouse.org wrote:
> Sure.  Here's the command and then the results.
> 
> # strace -o /tmp/log busybox seq 4 0 8 | head -n 5
> 4
> 4
> 4
> 4
> 4
> [ctrl-c required to exit back to shell]
> # cat /tmp/log
> execve("/bin/busybox", ["busybox", "seq", "4", "0", "8"], [/* 14 vars */]) = 0
> brk(0)                                  = 0x73000
> uname({sys="Linux", node="palm-webos", ...}) = 0
> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x35575000
....
> getuid32()                              = 0
> fstat64(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x35578000
> write(1, "4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n"..., 1024) = 1024
> write(1, "4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n"..., 1024) = -1 EPIPE (Broken pipe)
> --- SIGPIPE (Broken pipe) @ 0 (0) ---
> write(1, "\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4"..., 1024) = -1 EPIPE (Broken pipe)
> --- SIGPIPE (Broken pipe) @ 0 (0) ---
> write(1, "\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4"..., 1024) = -1 EPIPE (Broken pipe)
> --- SIGPIPE (Broken pipe) @ 0 (0) ---
> [ goes on forever ]

The parent process has SIGPIPE set to be ignored or masked. This is not
normally an expected case. I think you need to figure out why this happens
on your system ("trap '' SIGPIPE" somewhere in startup script?),
otherwise you'll see a lot of funny behavior from other programs too.

seq inherited this setting, therefore it doesn't die.

Meanwhile, please try the attached patch. It makes seq exit on write errors.
-- 
vda

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 7.patch
Type: text/x-diff
Size: 586 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20101017/79770439/attachment.bin>


More information about the busybox mailing list