Bug#751472: /lib/lsb/init-functions.d/40-systemd: init script integration: set +e; set +u changes behavior of init scripts

Ansgar Burchardt ansgar at debian.org
Fri Jun 13 11:25:44 BST 2014


Package: systemd
Version: 208-1
Severity: normal
File: /lib/lsb/init-functions.d/40-systemd

/lib/lsb/init-functions.d/40-systemd unconditionally uses "set +e; set
+u". This can change the behavior of init scripts that use "set -e"
and/or "set -u".

The systemd integration should not rely on "set +e" or "set +u", but
instead work correctly in all cases:

Instead of "set +u", access variables in a way that doesn't trigger an
exception when the variable is not set: "${foo:-}" will result in an
empty string when foo is not set.

Instead of "set +e", explicitly catch commands that might fail, for example

  something-that-might-fail || :

It is still okay to use "set +e; set +u" in the redirection code when
control is not returned to the init script.

I've attached an *untested* patch implementing what I described
above. Not sure if I missed anything.

Ansgar
-------------- next part --------------
A non-text attachment was scrubbed...
Name: systemd-init-integration.diff
Type: text/x-diff
Size: 2102 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-systemd-maintainers/attachments/20140613/e2fb2432/attachment-0001.diff>


More information about the Pkg-systemd-maintainers mailing list