Debhelper-generated postinst and prerm vs. manual one

Andreas Metzler ametzler at downhill.at.eu.org
Fri Oct 20 17:32:55 UTC 2006


On 2006-10-20 Fabian Fagerholm <fabbe at paniq.net> wrote:
> On Wed, 2006-10-18 at 10:35 -0400, Roberto C. Sanchez wrote:
>> I used the MAINTSCRIPT variable to solve bug #257181 while still being
>> able to exit with zero if it is called by dpkg.
[...]
> I can see where you're coming from, but I think you're actually being
> too clever and you're shooting yourself in the foot here :)

AOL.

> Actually, I think you're making the classical mistake of trying to
> control the output of the script in all cases. This can lead to hidden
> errors. It's better to let the script fail by default and then add the
> success cases as special cases with precise definitions. That way, no
> errors, even ones that you can't anticipate, will go unnoticed.

> Let's take the cases that the initscript handles, one by one:

> 1. saslauthd binary missing from /usr/sbin

> If the saslauthd binary hasn't been placed in /usr/sbin when dpkg runs
> postinst, then something is wrong, and invoke-rc.d should fail, alerting
> dpkg and the user. So we should never exit with 0 in this case, and
> always exit with a failure exit code.

I do not think this is a case you should try to special-case at all in
the init script. If you really think it is useful to try to detect
this dpkg breakage simply add

if ! test -x /usr/sbin/saslauthd ;then
        echo "End of world detected" 1>&2
        exit 1
fi

to the *postinst* script and keep the init-script simple. (Imho it is
useless. - If dpkg fails to asctually unpack packages there are a lot
bigger problems than init-scripts exiting with success.)

[...]
> I'm proposing the attached patch, or something similar, what do you
> think?

Looks good, except for removing the "$MAINTSCRIPT" == "yes" stuff
completely.

cu andreas
-- 
The 'Galactic Cleaning' policy undertaken by Emperor Zhark is a personal
vision of the emperor's, and its inclusion in this work does not constitute
tacit approval by the author or the publisher for any such projects,
howsoever undertaken.                                (c) Jasper Ffforde



More information about the Pkg-cyrus-sasl2-debian-devel mailing list