[PATCH] shell script error management in ash (set of 6 patches)

Roberto A. Foglietta roberto.foglietta at gmail.com
Sat Aug 21 12:47:21 UTC 2021


Il giorno sab 21 ago 2021 alle ore 14:38 Harald van Dijk <harald at gigawatt.nl>
ha scritto:

> Hi,
>
> In bash, the ERR trap is documented as triggering in under the exact
> same conditions that 'set -e' would cause the shell to abort. This is
> not what you have implemented, you have implemented it as triggering
> whenever a simple command returns non-zero. Consider:
>
> [...]

>
> Consider:
>
>    trap "echo ERR" ERR
>    false || true
>
> With bash, this prints nothing. With your patches, this prints ERR. That
> is, the ERR action is executed when it should not be. The command that
> failed here is one that had its exit status tested.


I confirm to you that the problem arises also during the execution of a
script of mine.

Probably I need time to address this issue. Thank you for having identified
it, -R.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20210821/cdbe4c25/attachment.html>


More information about the busybox mailing list