[Pkg-sysvinit-devel] Bug#406250: ignores errors from (invoke|update)-rc.d

Justin Pryzby justinpryzby at users.sourceforge.net
Tue Jan 9 21:34:51 CET 2007


Package: lintian,at,exim4,initscripts,udev,gdm
# Clone+Reassign soon

These packages all ignore errors from (invoke|update)-rc.d.

The History
===========

Due to debhelper bug #337664, dh_installinit inserted calls to packages
maintainer scripts which had "|| exit 0" rather than "|| exit $?" (due to
insufficient escaping).  The original intent (I assume) is to exit if the
program fails, even if the maintainer hasn't made the script set -e.  lintian
now includes a check for this, as requested in #358523 (but lintian.d.o isn't
yet updated to a sufficiently recent version).

The Problem
===========

I suspect that maintainers of packages which contain initscripts but don't use
dh_installinit have copied from debhelper, and now also include the broken
error checking code.  Lintian might not be able to find all the
problems, either, since some use "|| true" or "|| :" instead.

Proposal
========

The general problem is covered by policy, which requires all scripts to either
run set -e, or to test the exit status of every command.  || true shouldn't be
widely allowed, perhaps this could be expressed as foo || [ $? -ne 0 ], which
accomplishes the same, but indicates to lintian that the exit status is
actually checked.  (And the extra crud is reasonable to discourage people from
using it...)  Proper error checking in subshells should also be tested.

I propose that lintian detect this as a special case, and trigger the same or
comparable warning as for the debhelper bug.  (Ideally, I know that lintian
would grok Bourne).

It isn't clear to me that any of the following have a special reason for
ignoring errors, though exim4-daemon-light comments on the need for
it...

pryzbyj at cetus:/var/lib/dpkg/info$ grep -rE '(invoke|update)-rc\.d\b.*\|\|.*(true|:)' .
./at.prerm:     invoke-rc.d atd stop || true
./exim4-config.postinst:                        invoke-rc.d exim4 restart || true
./initscripts.postinst: update-rc.d -f single remove >/dev/null 2>&1 || :
./initscripts.postinst: update-rc.d -f mtab.sh remove >/dev/null 2>&1 || :
./initscripts.postinst: update-rc.d -f hostname.sh remove >/dev/null 2>&1 || :
./initscripts.postinst: update-rc.d -f sendsigs remove >/dev/null 2>&1 || :
./initscripts.postinst: update-rc.d $F remove >/dev/null 2>&1 || :
./initscripts.postinst:#                invoke-rc.d mountkernfs.sh start || :
./exim4-daemon-light.postinst:                  invoke-rc.d exim4 start || invoke-rc.d exim4 reload || true
./udev.postinst:    [ -x /etc/init.d/$script ] && invoke-rc.d $script restart || true
./gdm.postinst:  invoke-rc.d gdm reload || true




More information about the Pkg-sysvinit-devel mailing list