[Toybox] default SIGPIPE handler that calls _exit(0)?

enh enh at google.com
Fri Feb 17 14:45:51 PST 2017


fixed in adbd in AOSP master by
https://android-review.googlesource.com/#/c/340481/.

new updated comment attached.

On Thu, Feb 16, 2017 at 10:32 PM, enh <enh at google.com> wrote:
> 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.



-- 
Elliott Hughes - http://who/enh - http://jessies.org/~enh/
Android native code/tools questions? Mail me/drop by/add me as a reviewer.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-PATCH-Fix-the-comment-about-the-Android-SIGPIPE-beha.patch
Type: text/x-patch
Size: 1201 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20170217/3291eb77/attachment.bin>


More information about the Toybox mailing list