On 15/09/2021 20:47, Denys Vlasenko wrote:
On Wed, Sep 15, 2021 at 7:48 PM Roberto A. Foglietta
<roberto.foglietta@xxxxxxxxx> wrote:
Moreover,
the code that these exceptions trigger (everywhere the setjmp()
returns true) restores some values and frees some memory but the traps
need the information before the restore, not the restored values.
Yes, _this_ is the problem we are having.
E.g. $FUNCNAME in EXIT trap needs to be current function's name.
Important to also mention that although FUNCNAME is not part of POSIX,
and there is no spec to compare to, in bash and ksh it does not behave
that way, so you're talking about implementing FUNCNAME in a way that is
incompatible with existing shells. Which is fine if that is what you
want to do.
Cheers,
Harald van Dijk