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

Bug#406362: marked as done (ignores errors from (invoke|update)-rc.d)



Your message dated Tue, 27 Feb 2007 01:09:23 -0800
with message-id <[🔎] 87irdo0xx8.fsf@windlord.stanford.edu>
and subject line Bug#406362: ignores errors from (invoke|update)-rc.d
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--- Begin Message ---
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@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


--- End Message ---
--- Begin Message ---
> 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...

Given that of the five packages you reported this against, two of them
confirmed it was a false positive and initscripts looks like a false
positive to me as well, this is not filling me with enthusiasm.  I want
lintian to catch common maintainer errors, but I don't want it to hen-peck
maintainers or bug them about things they may have really meant.  This is
a hard one, since if the script is buggy the bug will rarely show up in
practice, but I'm not sure a lintian check is the right approach.  (And I
*really* dislike the idea of telling maintainers to obfuscate their code
to avoid a lintian warning.)

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


--- End Message ---

Reply to: