Build doesn't fail if od not installed

Rob Landley rob at landley.net
Wed Sep 22 20:52:07 UTC 2010


On Monday 20 September 2010 03:02:13 Ralf Friedl wrote:
> Rob Landley wrote:
> > All you need is an || exit 1 on the command line so the build _stops_ and
> > the error message doesn't get buried by other stuff.
> >
> > I tend to do big stacks of:
> >
> > thing &&
> > thing &&
> > thing &&
> > thing &&
> > thing || exit 1
>
> Why not just use "set -e" in the shell?

Been there, tried that.  There are rather a lot of commands which _are_ 
allowed to fail, and you either wind up toggling -e on and off a lot or you do 
a lot of "|| true" annotation on the end of stuff for no obvious reason, which 
is ugly and isn't always clear how to do in certain contexts like playing with 
here documents.

Also, "exit" isn't _always_ the handling you want.  For example, I have 
(paranthetical) things that happen in a subshell with their own environment 
variables, and when they die I need to signal the parent to kill it.  (I made 
a shell function "dienow" to do this, so I generally || dienow instead of || 
exit 1.  But the principle's the same.)

> It will exit on any error, without making everything harder to write and
> to read.

Being explicit is harder for you to read?

By the way, you can do one && two && three from the command line, I often do 
"configure -blah-blah-blah && make -j blah && make install" so I can set it 
running and it either finishes completely or stops at the error.  This isn't 
some obscure technique that changes the default behavior of the shell, this is 
shell programming 101...

Rob
-- 
GPLv3: as worthy a successor as The Phantom Menace, as timely as Duke Nukem 
Forever, and as welcome as New Coke.


More information about the busybox mailing list