Bug#562506: init scripts should not use set -e
On 29/12/2009 00:44, Russ Allbery wrote:
Steve Langasek<firstname.lastname@example.org> writes:
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.
That seems reasonable, although I think we should also point out the
problems with using set -e when starting a daemon, namely that you need to
be sure to wrap the start-stop-daemon invocation in a conditional so that
you can properly report errors, rather than just letting the init script
start-stop-daemon .... || RET=$?
This is a construction I often use in my scripts that avoid a "if then fi"
Vincent Danjean GPG key ID 0x9D025E87 email@example.com
GPG key fingerprint: FC95 08A6 854D DB48 4B9A 8A94 0BF7 7867 9D02 5E87
Unofficial packages: http://moais.imag.fr/membres/vincent.danjean/deb.html
APT repo: deb http://perso.debian.org/~vdanjean/debian unstable main