[Pkg-samba-maint] [samba] 03/04: Don't fail in postinst when removing old alternatives fails

Steve Langasek vorlon at debian.org
Mon Dec 9 19:06:27 UTC 2013

On Mon, Dec 09, 2013 at 07:56:58PM +0100, Ivo De Decker wrote:
> On Mon, Dec 09, 2013 at 10:23:34AM -0800, Steve Langasek wrote:
> > On Mon, Dec 09, 2013 at 06:06:41PM +0000, Ivo De Decker wrote:
> > >     Don't fail in postinst when removing old alternatives fails

> > What is the rationale for this?  Ignoring failures from commands like
> > update-alternatives is a good way to leave cruft behind on the system that
> > will never be cleaned up.  Why would these commands fail, and how can we
> > better handle the specific failure case?

> I got one specific failure case in my tests:

> When installing samba from jessie (2:4.0.12+dfsg-1), and upgrading to the new
> version (2:4.0.13+dfsg-1), the alternatives aren't there, so removing them
> fails. This makes the entire upgrade fail.

> When installing samba from wheezy (2:3.6.6-6+deb7u1) and then upgrading to
> jessie (2:4.0.12+dfsg-1), the alternatives are not correctly removed (this is
> the bug we are trying to fix). When upgrading from this version to
> 2:4.0.13+dfsg-1, they should be removed.

> It seems update-alternatives has no convenient way to remove alternatives only
> when they are there.

So we can instead do

  if update-alternatives --list nmblookup >/dev/null 2>&1 ; then
    update-alternatives --remove-all nmblookup

which only tries to remove the alternative if it's present - and avoids the
undesirable side effect of ignoring failures by update-alternatives to clean

Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slangasek at ubuntu.com                                     vorlon at debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-samba-maint/attachments/20131209/e68540d8/attachment.sig>

More information about the Pkg-samba-maint mailing list