Il giorno sab 21 ago 2021 alle ore 14:38 Harald van Dijk <har...@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:
>
>    trap "echo ERR" ERR
>    (:) >/access-denied
>
> With bash, this prints:
>
>    bash: line 2: /access-denied: Permission denied
>    ERR
>
> With your patches, this prints:
>
>    ash: can't create /access-denied: Permission denied
>
> That is, the ERR action is not executed when it should be. The command
> that failed here is not a simple command.
>
> 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.


 The 10th patch reworks the trap ERR in such a way which is compliant with
bash for both these cases.

 Thank you,
-- 
Roberto A. Foglietta
+39.349.33.30.697

Attachment: busybox-1.33.1-10of10-trap-ERR-reworked.patch
Description: Binary data

Attachment: testsuite.tgz
Description: application/compressed

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to