[Toybox] default SIGPIPE handler that calls _exit(0)?
Rob Landley
rob at landley.net
Wed Jun 10 11:23:07 PDT 2015
On 05/03/2015 03:53 PM, enh wrote:
> On Sat, May 2, 2015 at 1:32 PM, Rich Felker <dalias at libc.org> wrote:
>> On Sat, May 02, 2015 at 12:04:31PM -0700, enh wrote:
>>>> Sure, outside toybox yay sigpipe. But inside, the question is what the
>>>> correct behavior should be.
>>>>
>>>> It sounds like android wants _exit(0)
>>>
>>> no, not particularly. we're arguing internally about whether SIGPIPE
>>> is a crash or not. i think even undoing the dynamic linker's
>>> installation of a crash reporter by setting it back to SIG_DFL would
>>> be fine for toybox --- the real problem is that the dynamic linker
>>> doesn't know whether it's dealing with an Android app (where you
>>> probably do want the crash reporting) or a command-line tool (where
>>> you probably don't), let alone corner cases like a command-line tool
>>> that's implemented in Java.
>>
>> In that case the crash-reporting signal handler setup should be in the
>> Android app init code, not the dynamic linker, no?
>
> there are a large number of native-only daemons running on the average
> Android device, most of which we only see as binary blobs.
I have a todo item here, the posix guys have been proposing adding set
-o pipefail and doing their usual insane bikeshedding where "yes | head"
should always exit failure because yes couldn't successfully write all
its (infinite) output. Meanwhile head discarding input is what head is
_for_...
http://austingroupbugs.net/view.php?id=789
Not sure what the right answer is, error return-wise. The android
approach is to return success when terminating output due to -EPIPE (as
opposed to -ENOSPC or other errors), and I'm pretty happy to do the
same... assuming I can figure out how to beat the error out of ferror().
(You record that there _was_ an error, but not the errno. So I was
happily doing printf(), printf(), printf(), and then fflush() and
ferror() and if the earlier printf returned an errno you ate it and
didn't save it for me thank you very much...)
Anyway, opinions on this?
Rob
1433960587.0
More information about the Toybox
mailing list