[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#562506: init scripts should not use set -e



On Thu, Dec 24, 2009 at 04:07:48PM -0800, Russ Allbery wrote:

> Currently, Debian Policy makes a general statement that all Bourne shell
> scripts should start with set -e and does not (so far as I can see) make
> an exception for init scripts.  I've seen several init scripts use set -e,
> which is usually a bad idea.  It assumes that the shell function libraries
> used for status reporting are "set -e"-clean, which they may not be, and
> it causes the init scripts to exit in non-obvious ways and produce lots of
> debugging headache.

> I think there's already a consensus that set -e is the wrong approach for
> init scripts and instead the exit status of key commands should be checked
> instead.  I think Policy should reflect that consensus somewhere in the
> section on init scripts.

I don't think that 'set -e' is wrong for init scripts, so much as the LSB
init script interfaces' requirement of 'set +e' is an unfortunate design
flaw.  Still, as many init scripts are using /lib/lsb/init-functions
nowadays, I think it's worth calling this out in Policy as an exception.

We should explicitly qualify this in terms of /lib/lsb/init-functions being
an *optional* library that init scripts *may* use.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slangasek@ubuntu.com                                     vorlon@debian.org

Attachment: signature.asc
Description: Digital signature


Reply to: