Bug#562506: init scripts should not use set -e
Hi!
On Thu, 2009-12-24 at 16:07:48 -0800, Russ Allbery wrote:
> Package: debian-policy
> Version: 3.8.3.0
> Severity: minor
> 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.
In particular calls like “log_end_msg $?” after start-stop-daemon are
the obvious buggy ofenders. Or it makes the script do some interesting
gymnastics to retrieve the return code to be able to pass it on to
log_end_msg for example.
> 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.
Yes, please.
regards,
guillem
Reply to: