On 29/12/2009 00:44, Russ Allbery wrote:
Steve Langasek<vor...@debian.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
die.
RET=0
start-stop-daemon .... || RET=$?
log_end_msg $RET
This is a construction I often use in my scripts that avoid a "if then fi"
Regards,
Vincent
--
Vincent Danjean GPG key ID 0x9D025E87 vdanj...@debian.org
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
--
To UNSUBSCRIBE, email to debian-policy-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/4b87e89b.60...@ens-lyon.org