fontconfig: don't "clean up" on new installs

Bug #819097 reported by Geoffrey Thomas
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
fontconfig (Debian)
Fix Released
Unknown
fontconfig (Ubuntu)
Confirmed
Medium
Unassigned

Bug Description

This is a re-reporting of Debian #636173, since the actual failure is only triggered on Ubuntu.

debian/fontconfig.postinst includes this snippet:

  if dpkg --compare-versions "$2" lt 2.4.0-1; then
  printf "Cleaning up old fontconfig caches... "
  for dir in /usr/share/fonts /var/lib/defoma/fontconfig.d /usr/X11R6/lib/X11/fonts /usr/local/share/fonts ; do
        if [ -d $dir ]; then
            find $dir -name fonts.cache-1 -exec rm -f \{\} \;
            find $dir -depth -mindepth 1 -type d -exec rmdir --ignore-fail-on-non-empty \{\} \;
        fi
  done
  ...

This block gets run when fontconfig is initially installed, as well as when upgrading from fontconfig (<< 2.4.0-1). This interacts poorly with Ubuntu's ttf-mscorefonts-installer package, which includes an empty /usr/share/fonts/truetype/msttcorefonts directory and writes files to that directory in the postinst. If you install fontconfig and ttf-mscorefonts-installer in the same apt run, the directory will get unpacked, fontconfig's postinst will rmdir it, and ttf-mscorefont-installer's postinst will get really confused.

I proposed to Debian that it would suffice to just use "lt-nl" instead of "lt", so that an empty $2 (a new install) causes dpkg
--compare-versions to return false. That way the cleanup code only runs on upgrade from the old version of fontconfig, where it is presumably actually needed, and not on first install.

For more context, see
https://bugs.launchpad.net/ubuntu/+source/msttcorefonts/+bug/670629
comments 14 (which prompted packaging the empty directory) and 29
http://debathena.mit.edu/trac/ticket/975
comments "Pretty sure this is entirely different..." and "Anders and I found the bug..."

Michael Vogt (mvo)
Changed in fontconfig (Ubuntu):
status: New → Confirmed
importance: Undecided → Medium
Changed in fontconfig (Debian):
status: Unknown → New
Changed in fontconfig (Debian):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.