[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SIGPIPE warning

From: Pádraig Brady
Subject: Re: SIGPIPE warning
Date: Sat, 20 Apr 2013 18:13:59 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

On 04/20/2013 02:59 PM, James Youngman wrote:
> On Fri, Mar 9, 2012 at 10:41 PM, Pádraig Brady <address@hidden> wrote:
>> I noticed xargs output a warning about SIGPIPE
>> $ yes 1234 | xargs -n1 | head -n1
>> 1234
>> xargs: /bin/echo: terminated by signal 13
>> That's not normally the case on the shell:
>> $ yes 1234 | head -n1
>> 1234
>> Nor in other process management utils:
>> $ timeout 1 yes 1234 | head -n1
>> 1234
>> Could we supress that warning?
>> At least for SIGPIPE?
> Hmm, POSIX 
> (http://pubs.opengroup.org/onlinepubs/009695399/utilities/xargs.html)
> seems to require it:
>    If a command line meeting the specified requirements cannot be
> assembled, the utility cannot be invoked, an invocation of the utility
> is terminated by a signal, or an invocation of the utility exits with
> exit status 255, the xargs utility shall write a diagnostic message
> and exit without processing any remaining input.
> In this case the utility (echo) is indeed being terminated by a
> signal.    But IMO the report that echo was killed by a signal isn't
> helpful to the user in this case.  I think that "yes" gets away with
> this since it is not standardised by POSIX.
> If you can think of a way for xargs still to be POSIX-compliant while
> suppressing the message, that would probably be a good choice.    Any
> ideas?

Well to the letter of the law it would break POSIX "compliance".
Though this is in the context of "ERRORS", whereas SIGPIPE
could be thought of normal process flow, and is handled as such elsewhere.
I'd be inclined to only apply the letter of the law if the
POSIXLY_CORRECT env variable was set.
Also it might be something to bring up with POSIX.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]