Re: -e not ignored in substition under tests

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

 



On Fri, Jun 22, 2018 at 10:41:43PM +0800, Herbert Xu wrote:
> Benedikt Becker <benedikt.becker@xxxxxxxx> wrote:
> > Hi,
> > 
> > Dash does not ignore the -e option in substitutions $(...) under AND/OR lists and conditions. For example, in the program
> > 
> >     set -e
> >     echo "$(echo X; false; echo Y)" || true
> > 
> > the command `false` seems to interrupt the sequence and only X is printed (tested with dash 0.5.8.2 and git master). But according to my understanding of the POSIX specifications, `set -e` should be ignored under the OR list and X and Y should be printed . The same behaviour can be
> > observed when using the substitution in the condition of a while, until, and if. In contrast, set -e is effectively ignored in normal subshells under AND/OR lists and conditions (e.g., `set -e; (echo X; false; echo Y) || true` prints X and Y).
> > 
> > Is this a bug in dash or in my understanding?
> 
> I'd say that it's a bug.

Looking at this again it would appear that the pdksh lineage also
behaves like dash (and presumably other ash shells).  So I'd like
to hear other opinions first before changing this.

Cheers,
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux