Better error checking of config file by build scripts
bb at npl.de
Wed Dec 23 06:26:29 UTC 2020
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:
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:
...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 at npl.de>
Tested-by: Bastian Bittorf <bb at npl.de>
More information about the busybox