NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/46021: xargs should keep still
The following reply was made to PR bin/46021; it has been noted by GNATS.
From: David Holland <dholland-bugs%netbsd.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: bin/46021: xargs should keep still
Date: Tue, 14 Feb 2012 07:20:15 +0000
On Tue, Feb 14, 2012 at 04:50:00AM +0000, jklowden%schemamania.org@localhost
wrote:
> xargs writes error messages to standard error if the utility
> it's executing exits with an error or on a signal. E.g.:
>
> $ find /usr | xargs ls | head -1
> /usr/X11R7/bin/X
> xargs: ls terminated by SIGPIPE
>
> As the above example shows, the message is unwelcome and unnecessary.
> [...]
I don't agree with your reasoning. Let's consider a similar and not
uncommon case:
First, create a program that always exits with a signal:
% ./die
Segmentation fault
%
Now let's place it in a pipeline:
% find /usr/include | ./die
Segmentation fault
% find /usr/include | ./die | cat
Segmentation fault
% find /usr/include | xargs ./die
xargs: ./die terminated by SIGSEGV
% find /usr/include | xargs ./die | cat
xargs: ./die terminated by SIGSEGV
%
Looks to me like the behavior is uniform across all four cases. xargs
doesn't print the same message, but it's equivalent and printed in the
same circumstances.
With sh your argument is even weaker, as sh prints more:
$ find /usr/include | ./die
[1] Broken pipe find /usr/include |
Segmentation fault ./die
$ find /usr/include | ./die | cat
[1] Broken pipe find /usr/include |
Segmentation fault ./die |
Done cat
$ find /usr/include | xargs ./die
xargs: ./die terminated by SIGSEGV
$ find /usr/include | xargs ./die | cat
xargs: ./die terminated by SIGSEGV
$
zsh is similar to sh.
Maybe SIGPIPE should be handled differently from other signals, but
the change you've proposed is definitely wrong.
--
David A. Holland
dholland%netbsd.org@localhost
Home |
Main Index |
Thread Index |
Old Index