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

Roberto A. Foglietta roberto.foglietta at gmail.com
Sun Aug 22 13:53:23 UTC 2021


Hi Harald and Denys,

 @Harald: I did some extra tests which are in testB.sh and testC.sh to
further check if a memory leak might happen in a non-exit condition. I did
not found anyone. This is not a definitive proof of working but it is a
positive signal: we may be on the right track to close this patch.

 @Denis: I promise you to deliver a single patch including all the
functionalities I added to extend the error management in busybox ash. It
is in attachment with its test suite.

 The following patch add the following functionalities:

 - adds set -/+E for error tracing in functions
 - adds trap ERR to trap errors
 - adds FUNCNAME as global variable
 - makes LINENO as global variable
 - on command line execution ash -c the LINENO is set 0, compliant with
bash (*)
 - it add a printf to highlight a possible memory leak in a not-exit
condition (**)

 (*) alternative is to set it to 1 but it is a matter of a simple value
assignment. I wish you not to worry about that because the final decision
will be yours.

 (**) Moreover, I added a printf in a special point to highlight a possible
memory leak if that print-out happens in a not-exit condition. If this
patch survive to our test and code analysis then before applying it in
production the printf line should be replaced with a void line It is
easy to find: grep -n printf $patch

 Thank you Harald for your support and thank you Denis in advance for your
code analysis.

 Cheers,
-- 
Roberto A. Foglietta
+39.349.33.30.697
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20210822/e2c31921/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: busybox-1.33.1-error-management-extension-for-ash-v013.patch
Type: application/octet-stream
Size: 11379 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20210822/e2c31921/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testsuite.tgz
Type: application/x-compressed
Size: 2723 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20210822/e2c31921/attachment-0001.bin>


More information about the busybox mailing list