[Toybox] default SIGPIPE handler that calls _exit(0)?
enh
enh at google.com
Thu Feb 16 22:32:18 PST 2017
On Thu, Feb 16, 2017 at 1:46 PM, Rob Landley <rob at landley.net> wrote:
> On 02/15/2017 06:43 PM, enh wrote:
>> works for me, thanks. the comment isn't quite right though. patch attached.
> ...
>> - // Bionic's dynamic linker adds a handler to report SIGPIPE as an error,
>> - // then doesn't want that behavior for toybox. So disable it for bionic.
>> + // Up to and including Android 6.0 (Marshmallow), bionic's dynamic linker
>> + // added a handler to cause a crash dump on SIGPIPE. That was removed in
>> + // Android 7.0 (Nougat), but Android still gets bug reports about the
>> + // regular "ps: write: broken pipe" output when someone pipes the output
>> + // of ps into head.
>> if (CFG_TOYBOX_ON_ANDROID) signal(SIGPIPE, SIG_DFL);
>
> The new code sets it to SIG_DFL, and you said that works for you, so
> where is the "regular" error message you referred to coming from?
an excellent question, with a non-obvious answer...
it turns out that adbd sets SIGPIPE to SIG_IGN, and that's propagated
to the shell and hence to toybox. so command-line stuff on Android
sees a lot more EPIPEs than you'd expect. seems unintentional, so i'll
try to find time to fix that tomorrow.
> Built against glibc:
>
> $ ./ps -A | head
> PID TTY TIME CMD
> 1 ? 00:01:01 init
> 2 ? 00:00:01 kthreadd
> 3 ? 00:16:17 ksoftirqd/0
> 5 ? 00:00:00 kworker/0:0H
> 7 ? 05:17:42 rcu_sched
> 8 ? 00:00:00 rcu_bh
> 9 ? 00:00:44 migration/0
> 10 ? 00:00:43 watchdog/0
> 11 ? 00:00:27 watchdog/1
> landley at driftwood:~/toybox/toy3$
>
> Built against musl:
>
> $ ./ps -A | head
> PID TTY TIME CMD
> 1 ? 00:01:01 init
> 2 ? 00:00:01 kthreadd
> 3 ? 00:16:17 ksoftirqd/0
> 5 ? 00:00:00 kworker/0:0H
> 7 ? 05:17:47 rcu_sched
> 8 ? 00:00:00 rcu_bh
> 9 ? 00:00:44 migration/0
> 10 ? 00:00:43 watchdog/0
> 11 ? 00:00:27 watchdog/1
> landley at driftwood:~/toybox/toy3$
>
> I'm not seeing this error message here?
>
> Rob
> _______________________________________________
> Toybox mailing list
> Toybox at lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net
--
Elliott Hughes - http://who/enh - http://jessies.org/~enh/
Android native code/tools questions? Mail me/drop by/add me as a reviewer.
More information about the Toybox
mailing list