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

Harald van Dijk harald at gigawatt.nl
Mon Aug 23 09:15:13 UTC 2021


On 23/08/2021 10:09, Roberto A. Foglietta wrote:
> Il giorno lun 23 ago 2021 alle ore 10:45 Harald van Dijk 
> <harald at gigawatt.nl <mailto:harald at gigawatt.nl>> ha scritto:
> 
>     On 23/08/2021 09:16, Roberto A. Foglietta wrote:
>      > IMHO, syntax error should be an exit condition either.
> 
>     I would not have a problem with you changing the shell to ensure syntax
>     errors always terminate (though I cannot speak for others), but the
>     problem is not limited to syntax errors, so that is not enough to fix
>     the problem.
> 
>      > For the moment we can still assume that in busybox all exceptions
>     are
>      > deadly.
> 
>     I do not understand this, not even with your followup e-mail. You
>     changed my test in which the syntax error is non-fatal to one where the
>     syntax error is fatal, and then conclude from that that you can assume
>     syntax errors are always fatal? That does not work. If you have two
>     tests with syntax errors, where the syntax errors are fatal in only one
>     of them, that means you can *not* assume all syntax errors are fatal,
>     and can *not* assume all exceptions are deadly.
> 
> 
> Hi Harald,
> 
>   we need to synchronise each other a bit. Step by step, I will try to 
> be clearer.
> 
>   > I would not have a problem with you changing the shell to ensure syntax
> 
>   I did NOT changed anything, it is in such a way even in the original 
> busybox. AFAIK.
>   In the original busybox there is no trap ERR so I cannot try but I did 
> not changed that.
> 
>   > You changed my test in which the syntax error is non-fatal to one 
> where the syntax error is fatal
>   I did not changed anything about the fatal trap. The trap you 
> submitted is non-fatal in bash but fatal in busybox ash.
> 
>   You suggested this
> 
>   trap ")" ERR; false  (command eval false -> false)
> 
>   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).

>   PLEASE: confirm me we are aligned on this before I go to explain 
> myself better on (isdeadly(e))


More information about the busybox mailing list