Re: set -e not ignored in AND-OR list

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

 



Think I found another case:


$ dash; echo shell left
$ set -e; foo() { echo a >&2; false; echo b >&2; }
$ echo "$(foo)"    
a

=> expected, no reason to ignore -e, no exit either, as part of word
   expansion (POSIX’ point (1))


$ echo "$(foo)" | true
a
=> expected, no reason to ignore -e, no exit either, as pipefail not in
   effect

$ echo "$(foo)" || true
a

$ echo "$(foo)" && true
a

=> the above two are probably the same bug from before, I just mention
   them again, as it does happen in a word expansion, so a future check
   for this might want t test both cases
   (bash in both prints a and b)


Here's the new one:

$ ! echo "$(foo)" | true
a
$ 
=> before,
     $ ! foo | true
   worked properly in dash, i.e. the -e WAS ignored
   but here it is NOT ignored, which I think it should be

And in fact, bash for the same gives:
$ bash; echo shell left
$ shopt -s inherit_errexit
$ set -e; foo() { echo a >&2; false; echo b >&2; }
$ ! echo "$(foo)" | true
a
b
$


Cheers,
Chris.





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

  Powered by Linux