[Pkg-fonts-devel] Bug#699905: fonts-vlgothic: does not remove ttf-japanese-gothic.ttf alternative on upgrades from squeeze

Andreas Beckmann anbe at debian.org
Wed Feb 6 15:12:16 UTC 2013


Package: fonts-vlgothic
Version: 20120629-1
Severity: important
User: debian-qa at lists.debian.org
Usertags: piuparts

Hi,

<template>

during a test with piuparts I noticed your package left unowned files on
the system after purge, which is a violation of policy 6.8:

http://www.debian.org/doc/debian-policy/ch-maintainerscripts.html#s-removedetails

The leftover files are actually alternatives that were installed by the
package but have not been properly removed.

While there is ongoing discussion how to remove alternatives correctly
(see http://bugs.debian.org/71621 for details) the following strategy
should work for regular cases:
* 'postinst configure' always installs the alternative
* 'prerm remove' removes the alternative
* 'postrm remove' and 'postrm disappear' remove the alternative
In all other cases a maintainer script is invoked (e.g. upgrade,
deconfigure) the alternatives are not modified to preserve user
configuration.
Removing the alternative in 'prerm remove' avoids having a dangling link
once the actual file gets removed, but 'prerm remove' is not called in
all cases (e.g. unpacked but not configured packages or disappearing
packages) so the postrm must remove the alternative again
(update-alternatives gracefully handles removal of non-existing
alternatives).

Note that the arguments for adding and removing alternatives differ, for
removal it's 'update-alternatives --remove <name> <path>'.

Filing this as important as having a piuparts clean archive is a release
goal since lenny.

</template>

>From the attached log (scroll to the bottom...):

0m57.5s INFO: Warning: Package purging left files on system:
  /etc/alternatives/ttf-japanese-gothic.ttf -> /usr/share/fonts/truetype/vlgothic/VL-Gothic-Regular.ttf	 not owned
  /usr/share/fonts/	 owned by: fonts-vlgothic
  /usr/share/fonts/truetype/	 owned by: fonts-vlgothic
  /usr/share/fonts/truetype/ttf-japanese-gothic.ttf -> /etc/alternatives/ttf-japanese-gothic.ttf	 not owned


Due to the package rename, the stuff in the preinst script is not being
run at all during upgrades from squeeze: fonts-vlgothic will always be a
new install, so "$2" will be empty and all the
  dpkg --compare-versions "$2" lt-nl "$someversion"
will evaluate to false.

I'm not sure about the impact of this bug for stable users: what happens
if both ttf-japanese-gothic.ttf and fonts-japanese-gothic.ttf are
available on the system? (On a fresh upgrade from squeeze both will
point to the same existing file.)
And worse: what will happen if fonts-vlgothic is removed later on and
replaced by another font that provides the fonts-japanese-gothic.ttf
alternative? At that point only fonts-japanese-gothic.ttf will exist and
ttf-japanese-gothic.ttf will be a dangling symlink. May this have
negative impact on applications using such fonts?

If this is really bad, please raise severity to RC and fix via TPU.

I'm attaching a patch for the version in wheezy, but it should apply in
experimental or sid as well. I have not tried to "fix" the preinst, just
added another instance of alternative removal (that is probably already
existing but inactive in the code above it) that should qualify for TPU
if needed.

cheers,

Andreas

PS: another remark for the preinst stuff: getting rid of the old
conffile should nowadays be a job for dpkg-maintscript-helper, except
that it does not work for removing an obsolete conffile owned by another
package and the "current" package is a fresh installation (well, I think
that you can work around this with passing ${2:-0} as an argument so
that the old version is not empty ...)

PPS:
once the patch gets applied to experimental (or sid, in a version that
supersedes experimental), you can put guards around it:

if dpkg --compare-versions "$2" lt "$THEVERSIONWHEREYOUINTRODUCETHISINTOSID"
then
  u-a remove ...
fi

Note the "lt" not "lt-nl" - this needs to be run on initial install and
upgrades from any version that did not have this piece of code.
But then again, update-alternatives --remove works gracefully on not
existing alternatives - no errors, no noise


Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fonts-vlgothic_20120629-1.1.dsc.diff
Type: text/x-diff
Size: 1629 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-fonts-devel/attachments/20130206/485d180e/attachment.diff>


More information about the Pkg-fonts-devel mailing list