Il giorno mar 24 ago 2021 alle ore 00:00 Harald van Dijk <har...@gigawatt.nl>
ha scritto:

> On 23/08/2021 11:50, Roberto A. Foglietta wrote:
> > Il giorno lun 23 ago 2021 alle ore 11:15 Harald van Dijk
> > <har...@gigawatt.nl <mailto:har...@gigawatt.nl>> ha scritto:
> >
> >     On 23/08/2021 10:09, Roberto A. Foglietta wrote:
> >      > Il giorno lun 23 ago 2021 alle ore 10:45 Harald van Dijk
> >      > <har...@gigawatt.nl <mailto:har...@gigawatt.nl>
> >     <mailto:har...@gigawatt.nl <mailto:har...@gigawatt.nl>>> ha scritto:
> >      >
> >      >     On 23/08/2021 09:16, Roberto A. Foglietta wrote:
> >
> >      >   I did the same.
> >
> >     You changed command eval false to false, but the 'command' builtin
> was
> >     the key element there, that is what made the syntax error non-fatal.
> >     'command eval false' is not the same thing as simply 'false' (at
> least
> >     not in busybox ash).
> >
> >
> > Hi Harald, thanks to your deep knowledge of the shell we finally reached
> > the point!
> >
> > The attached patch solves two questions/issues:
> >
> >   - not exit exceptions disables trap ERR (solved)
> >   - not exit exceptions might do memory leak (not the case, verified)
>
> Sorry, but this approach cannot work. The fact that an exception was
> raised and handled does not tell you where it was handled, it does not
> tell you whether the handler is still active.
>
> Consider:
>
>    trap '
>    command eval ")"
>    false
>    ' ERR
>    false
>    echo done
>

Thanks again for your insightfulness.

I reverted back to the previous situation when I was resetting the
recursive flag when the evaltree returns:

 - if evaltree returns: no problem
 - before an not-exit not-returning exception is raised, it sets an handler
that makes it returning

 Moreover, I used static variables to save the previous state in such a way
I am able to set back again in case my handler takes off.
 I have updated the testsuite and moved the test9.sh in testD.sh plus
testD.sh makes the check of the last case you arise to my attention.

 The full patch is here:

 https://github.com/robang74/tinycore-editor/tree/main/busybox/patches
 busybox-1.33.1-error-management-extension-for-ash-v017.patch

 Best regards,
-- 
Roberto A. Foglietta
+39.349.33.30.697

Attachment: busybox-1.33.1-not-returning-handlers-return-by-handler.patch
Description: Binary data

Attachment: testsuite.tgz
Description: application/compressed

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to