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

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

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



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:


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
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

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.


>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.



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 ...)

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"
  u-a remove ...

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

diffstat for fonts-vlgothic-20120629 fonts-vlgothic-20120629

 changelog              |   10 ++++++++++
 fonts-vlgothic.preinst |    6 ++++++
 2 files changed, 16 insertions(+)

diff -Nru fonts-vlgothic-20120629/debian/changelog fonts-vlgothic-20120629/debian/changelog
--- fonts-vlgothic-20120629/debian/changelog	2012-06-29 09:29:25.000000000 +0200
+++ fonts-vlgothic-20120629/debian/changelog	2013-02-06 15:18:40.000000000 +0100
@@ -1,3 +1,13 @@
+fonts-vlgothic (20120629-1.1) UNRELEASED; urgency=low
+  * Non-maintainer upload.
+  * fonts-vlgothic.preinst: Remove the alternative set up by ttf-vlgothic in
+    squeeze. This needs to be done unconditionally as it is not possible to
+    distinguish between new installation of fonts-vlgothic and upgrade from
+    ttf-vlgothic.  (Closes: #xxxxxx)
+ -- Andreas Beckmann <anbe@debian.org>  Wed, 06 Feb 2013 15:13:01 +0100
 fonts-vlgothic (20120629-1) unstable; urgency=low
   * New upstream release 
diff -Nru fonts-vlgothic-20120629/debian/fonts-vlgothic.preinst fonts-vlgothic-20120629/debian/fonts-vlgothic.preinst
--- fonts-vlgothic-20120629/debian/fonts-vlgothic.preinst	2011-09-18 16:16:57.000000000 +0200
+++ fonts-vlgothic-20120629/debian/fonts-vlgothic.preinst	2013-02-06 15:12:57.000000000 +0100
@@ -72,6 +72,12 @@
+  # Unconditionally remove the alternative set up by the old
+  # ttf-vlgothic package. We can't distinguish between new
+  # installations and "upgrades" from the old package name.
+  update-alternatives --remove ttf-japanese-gothic.ttf \
+	  /usr/share/fonts/truetype/vlgothic/VL-Gothic-Regular.ttf

Reply to: