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

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



martin f krafft <madduck@debian.org> writes:
> also sprach Bastian Blank <waldi@debian.org> [2010.02.27.1320 +0100]:

>> set -e produces problems like this: #546743.

> lsb-base should not get away with "because we write shitty shell code
> and don't do proper error handling, we expect everyone else to do
> alike". If set -e is causing problems, remember that we're talking about
> symptoms.

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.

-- 
Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>



Reply to: