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 <[email protected]> wrote: > On Thu, Feb 16, 2017 at 1:46 PM, Rob Landley <[email protected]> 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@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@driftwood:~/toybox/toy3$ >> >> I'm not seeing this error message here? >> >> Rob >> _______________________________________________ >> Toybox mailing list >> [email protected] >> 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.
From 9f95a36b7400f724a96e891fe4d1bd996fd7c891 Mon Sep 17 00:00:00 2001 From: Elliott Hughes <[email protected]> Date: Fri, 17 Feb 2017 14:43:56 -0800 Subject: [PATCH] [PATCH] Fix the comment about the Android SIGPIPE behavior. --- main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index a2267da..d05cbfe 100644 --- a/main.c +++ b/main.c @@ -213,8 +213,12 @@ int main(int argc, char *argv[]) } *argv = getbasename(*argv); - // 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 M, bionic's dynamic linker added a handler to + // cause a crash dump on SIGPIPE. That was removed in Android N, but adbd + // was still setting the SIGPIPE disposition to SIG_IGN, and its children + // were inheriting that. In Android O, adbd is fixed, but manually asking + // for the default disposition is harmless, and it'll be a long time before + // no one's using anything older than O! if (CFG_TOYBOX_ON_ANDROID) signal(SIGPIPE, SIG_DFL); // If nommu can't fork, special reentry path. -- 2.11.0.483.g087da7b7c-goog
_______________________________________________ Toybox mailing list [email protected] http://lists.landley.net/listinfo.cgi/toybox-landley.net
