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

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

also sprach Russ Allbery <rra@debian.org> [2010.03.01.0744 +0100]:
> I think lsb-base should be fixed, but I also think set -e in an init
> script is a bad idea.  I would argue that specifically because running
> commands that fail is a normal and expected init script operation, unlike
> nearly every other shell script, so set -e just makes it harder to write a
> script that functions correctly according to Policy.  It also makes the
> init script fragile in ways that are painfully hard to debug when things
> like the LSB functions don't account for set -e.
> I've personally run into three or four serious bugs in packages because of
> set -e, and I've never seen a case where having set -e prevented or
> diagnosed a problem that would have otherwise gone unnoticed.

I still think set -e is a good idea, but I realise it boils down to
preference. If your experience is representative, then it's probably
better to advocate not setting set -e in init scripts.

What about maintainer scripts?

 .''`.   martin f. krafft <madduck@d.o>      Related projects:
: :'  :  proud Debian developer               http://debiansystem.info
`. `'`   http://people.debian.org/~madduck    http://vcs-pkg.org
  `-  Debian - when you have better things to do than fixing systems
"president thieu says he'll quit if he doesn't get more than 50% of
 the vote. in a democracy, that's not called quitting."
                                                -- the washington post

Attachment: digital_signature_gpg.asc
Description: Digital signature (see http://martin-krafft.net/gpg/)

Reply to: