[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: errexit inconsistent behaviour with pipelines
From: |
Chet Ramey |
Subject: |
Re: errexit inconsistent behaviour with pipelines |
Date: |
Mon, 06 Oct 2008 22:31:36 -0400 |
User-agent: |
Thunderbird 2.0.0.17 (Macintosh/20080914) |
Chet Ramey wrote:
>> Will setting pipefail have any effect on this? If not, then is there a
>> way to make bash abort when one of the pipeline components fails,
>> without too much additional code?
Not easily.
>> On the other hand, to match the documentation, you would also have to
>> fix cases such as:
>>
>> set -e
>> true && false
>> echo done
>>
>> As they are not simple commands either, right? The manpage even
>> explicitly says that it "does not exit if the command that fails is
>> [...] part of a && or ││ list".
>
> That's true, except every other shell behaves this way. It works for
> compatibility. I'm going to have to audit this stuff, at the very
> least.
I should add that it's pretty much unanimous consensus among the `major'
shell implementers that this ambiguous language is a defect in the
standard, and the failure of the rightmost command in an AND or OR list
should cause the shell to exit.
I think the current behavior, once the pipeline stuff is fixed, is
pretty much correct.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/