[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: Better error checking of config file by build scripts
From:       Bastian Bittorf <bb () npl ! de>
Date:       2020-12-23 6:26:29
Message-ID: 20201223062629.qgxeu4ff6eftdmtq () hp-nas ! internet
[Download RAW message or body]

On Mon, Dec 21, 2020 at 08:22:59AM +0100, Bastian Bittorf wrote:
> On Mon, Dec 21, 2020 at 05:28:36AM +0000, Paul Larkin wrote:
> >  #!/bin/sh
> >  
> > +set -e
> >  . ./.config || exit 1
> > +set +e
> 
> IMHO the posix way is
> 
> command . ./.config || exit 1
> 
> The set -e/+e seems fragile, see:
> https://www.in-ulm.de/~mascheck/various/set-e/

I had to admit, that i did not fully understand
the underlying issue. Paul explained it in PM.

Now i want to say, that the set -e/+e approach is
the only feasible approach to catch such mistakes.

# example file which gets included/sourced:
VAR1=val
VAR2="$(foo)"
VAR3=val

...and the command/call/program 'foo' does not
exist is the underlying problem.

what is NOT needed is the appendix: || exit 1
this is, what set -e is doing already implicit,
but it explains the code somehow...

Reviewed-by: Bastian Bittorf <bb@npl.de>
Tested-by: Bastian Bittorf <bb@npl.de>

bye, Bastian
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic