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.
On 14/08/2021 17:14, Roberto A. Foglietta wrote:
Hi all,
I will send the whole six patches developed in these days with the
test suite in a tarball.
busybox-1.33.1-1of6-add-trap-ERR-to-ash.patch
busybox-1.33.1-2of6-trap-ERR-fix-global-LINENO.patch
busybox-1.33.1-3of6-set-E-error-trace-added.patch
busybox-1.33.1-4of6-global-FUNCNAME.patch
busybox-1.33.1-5of6-multiline-trap-LINENO-bugfix.patch
busybox-1.33.1-6of6-when-FUNCNAME-is-null-bugfix.patch
The whole set enanches the shell script management in ash (compatible
with bash)
Best regards,
--
Roberto A. Foglietta
+39.349.33.30.697
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox