Il giorno sab 14 ago 2021 alle ore 14:29 Harald van Dijk <[email protected]>
ha scritto:

>
> One case not covered in your tests is multi-line trap handlers. If
> LINENO in a trap handler, whether ERR, EXIT, or anything else, is
> supposed to refer to the point where it activated, then I think it
> should do so all throughout the trap handler. Correct me if I am
> misreading your patches, but I think that is not what you are doing, I
> think you only start counting at the point where it activated. Is that
> correct? If so, is that the behaviour you are after?
>

I developed another patch to fix a problem arised by multi-line trap
handlers.
They are not common and IMHO useless because functions could be used in
traps.
They are a corner case but I agree that they are worth a thought.

The $LINENO could be evaluated at the trap definition, like this

 trap "echo lineno: $LINENO" ERR

Or the $LINENO could be evaluated when the trap's exception arises, like
this:

 trap 'echo lineno: $LINENO' ERR

 Double or single quotes make such a difference.

 In both cases the $LINENO should remain constant during the trap life.

 This patch grants what above. The test5.sh shows it.

 Thank you,
-- 
Roberto A. Foglietta
+39.349.33.30.697

Attachment: busybox-1.33.1-5of5-multiline-trap-LINENO-bugfix.patch
Description: Binary data

Attachment: testsuite.tgz
Description: application/compressed

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to