[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 21:53:38 -0400 |
User-agent: |
Thunderbird 2.0.0.17 (Macintosh/20080914) |
Marcin Owsiany wrote:
> On Mon, Oct 06, 2008 at 04:09:49PM -0400, Chet Ramey wrote:
>>> That's the case that's behaving correctly, even though it's not the
>>> way you want it to behave. Neither case should terminate the shell.
>>> Only a simple command should terminate the shell, and a pipeline is
>>> not a simple command, even if its components are. Chet is saying that
>>> the next bash release will fix this bug - meaning that "true | false"
>>> will no longer cause the shell to exit.
>> Yes. I'm sorry that I was not as clear as I should have been.
>
> Oh, I certainly didn't expect it to be fixed this way :-)
>
> 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?
>
> 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.
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/