bug in ash set -e

Ron Yorston rmy at pobox.com
Wed Nov 9 16:12:41 UTC 2016


Natanael Copa wrote:
>I have found a bug (or weird feature?) in busybox ash:
>
>$ dash -c "set -e ; ( false ) ; echo 'should not echo'"
>$ bash -c "set -e ; ( false ) ; echo 'should not echo'"
>$ ash -c "set -e ; ( false ) ; echo 'should not echo'"
>should not echo
>$
>
>It looks like `set -e` does not catch error in ( )

This is true in 1.25.1.  It's fixed in master by this:

commit 204c7fb2293f67f6277f917e854188f5540e6955
Author: Rostislav Skudnov <rostislav at tuxera.com>
Date:   Fri Sep 16 19:04:02 2016 +0000

    ash: exit after subshell error when errexit option is set
    
    When "set -e" option is on, shell must exit when any command fails,
    including compound commands of the form (compound-list) executed in a
    subshell. Bash and dash shells have this behaviour.
    
    Also add a corresponding testcase.

Ron


More information about the busybox mailing list