Re: [PATCH] [EVAL] with set -e exit the shell if a subshell exits non-zero

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

On Mon, 28 Jun 2010, Herbert Xu wrote:

> On Mon, Jun 14, 2010 at 09:56:03AM +0000, Gerrit Pape wrote:
> > Example:
> >
> > $ dash -c 'set -e; (false); echo here'
> > here
> >
> > With this commit, dash exits 1 before echo.
> >
> > The bug was reported by Stefan Fritsch through
> >
> >
> > Signed-off-by: Gerrit Pape <pape@xxxxxxxxxxx>
> I'm not convinced that this change is necessary.  I've run some
> tests and bash/pdksh both behave like dash, while ksh93 behaves
> in the way you suggest.
> Has bash's behaviour changed recently (I'm using an ancient
> version)?

bash 3.2.39 and 4.0.37 are behaving as dash without the suggested
patch.  Still.  What is the correct behaviour?  That should be the
essential matter IMO, not what others do.  So, why should this fail:

	$ dash -c 'set -e; false; echo here'

and this succeed?

	$ dash -c 'set -e; (false); echo here'

The subshell returns exit code 1, and errexit is set.  Why does dash
ignore that exit code in the later case?


To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at

[LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

Powered by Linux