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

Re: prerm/postrm considered harmful in M-A: same packages


On Wed, 2014-01-15 at 16:40:16 -0800, Steve Langasek wrote:
> On Thu, Nov 07, 2013 at 03:37:26PM +0100, Guillem Jover wrote:
> > dpkg 1.17.2 will setup DPKG_MAINTSCRIPT_PACKAGE_REFCOUNT to make this
> > easier to handle. The aforementioned thread contains recipes on how to
> > do proper ref-counting with older dpkg versions.
> Thanks for implementing this, Guillem.

No problem!

> I've had a chance to look at using this now in the libpam-cracklib prerm, to
> fix bug #647428.  Since dpkg 1.17.2 is newer than what's available in
> wheezy, we need to decide on appropriate upgrade handling.

(Your changelog has a typo for the dpkg variable.)

> Rather than enforcing a versioned dep on dpkg (>= 1.17.2), which gets in the
> way of backports etc., I opted for the following pattern:
> if [ "$1" = remove ] && [ "${DPKG_MAINTSCRIPT_PACKAGE_REFCOUNT:-1}" = 1 ];
> then
> 	pam-auth-update --package --remove cracklib
> fi
> This will still be buggy when called from an older dpkg, but since this is a
> removal script that will only be in jessie, it's unlikely to be called until
> after dpkg has been upgraded.  And if it is called from an older dpkg, it
> will fall back to the previous (recoverable) behavior.

As mentioned in the quoted text, the previous thread on this contains
a recipe to handle older dpkg versions, something like this could do:

  # dpkg-query -f '${db:Status-Abbrev} ${binary:Package}\n' -W pkgname | \
    grep -v '^.n' | wc -l

which could be used to set DPKG_MAINTSCRIPT_PACKAGE_REFCOUNT if not
already set.


Reply to: