Re: errexit inconsistent behaviour with pipelines

2008-10-06 Thread Chet Ramey
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

Re: errexit inconsistent behaviour with pipelines

2008-10-06 Thread Chet Ramey
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 i

Re: errexit inconsistent behaviour with pipelines

2008-10-06 Thread Marcin Owsiany
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 comma

Re: errexit inconsistent behaviour with pipelines

2008-10-06 Thread Chet Ramey
> 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

Re: errexit inconsistent behaviour with pipelines

2008-10-06 Thread Paul Jarc
Marcin Owsiany <[EMAIL PROTECTED]> wrote: > On Mon, Oct 06, 2008 at 09:22:30AM -0400, Chet Ramey wrote: >> This bug only occurs when errexit is enabled and the final element of a >> pipeline is a simple command that returns a non-zero exit status. > > Well, if the final element in the pipeline is a

Re: errexit inconsistent behaviour with pipelines

2008-10-06 Thread Marcin Owsiany
On Mon, Oct 06, 2008 at 09:22:30AM -0400, Chet Ramey wrote: > Marcin Owsiany wrote: > > > I expected that if a simple pipeline failure causes the shell to exit, and > > a simple for loop failure causes it to exit, then a failure in their > > combination would also cause an exit. However it is no

Re: errexit inconsistent behaviour with pipelines

2008-10-06 Thread Chet Ramey
Marcin Owsiany wrote: > I expected that if a simple pipeline failure causes the shell to exit, and a > simple for loop failure causes it to exit, then a failure in their > combination would also cause an exit. However it is not so. You've found a probable bug, but it's not where you think. Eac

errexit inconsistent behaviour with pipelines

2008-10-05 Thread Marcin Owsiany
Hello, I have these three very simple scripts. The only difference between them is the penultimate line of each of them: | $ head -n 6 just_pipe just_for_loop pipe_and_for_loop | ==> just_pipe <== | set -e | trap 'echo aborted in line $LINENO' ERR | echo start | true | false | echo ended succes