[PATCH] adding the trap ERR feature

Roberto A. Foglietta roberto.foglietta at gmail.com
Fri Aug 13 22:45:12 UTC 2021


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

>
> However, for functions defined outside of a script, the only way to
> interpret the requirements is for LINENO to remain relative to the start
> of the function as it is now.
>

 Hi Harald, thank you for having shared your point of view.

 I agree that POSIX specs are important but not mandatory.
 Moreover they not always very specific like in this case.

 Obviously for the functions defined elsewhere it might be different.
 I prepared a test but feel free to improve it. Here the results:

roberto at vm-ubuntu18:~/tinycore-editor/busybox$ src/busybox ash ./test2.sh
ash: using fallback suid method
ciao! at line 29 == 29
hello at line 22 == 22
ERROR: test2.sh failed at line 23, rc: 1
onerror() at line 16 == 16
mytest should have failed at line 23
pippo
ERROR: test2.sh failed at line 34, rc: 1
onerror() at line 16 == 16
exit at line 34 == 34 with pippo but not pluto


-- 
Roberto A. Foglietta
+39.349.33.30.697
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20210814/b037be1e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test2.sh
Type: text/x-sh
Size: 325 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20210814/b037be1e/attachment.sh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: funcs.sh
Type: text/x-sh
Size: 343 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20210814/b037be1e/attachment-0001.sh>


More information about the busybox mailing list