Bug 1169979 - fontconfig cache updating does not work reliably during live image generation
Summary: fontconfig cache updating does not work reliably during live image generation
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: fontconfig
Version: 24
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Akira TAGOH
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-12-02 21:57 UTC by Adam Williamson
Modified: 2016-06-10 06:50 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-06-10 06:50:04 UTC


Attachments (Terms of Use)
F21 Workstation with the good font (DejaVu Sans Mono) (162.19 KB, image/png)
2014-12-02 22:08 UTC, Adam Williamson
no flags Details
F21 Workstation with the bad font (Nimbus Mono L) (180.94 KB, image/png)
2014-12-02 22:10 UTC, Adam Williamson
no flags Details


Links
System ID Priority Status Summary Last Updated
Red Hat Bugzilla 1236034 None CLOSED many fonts missing in fontconfig cache after installation, forced refresh needed 2019-06-25 10:08:21 UTC

Internal Links: 1236034

Description Adam Williamson 2014-12-02 21:57:48 UTC
We've spotted an issue with Fedora 21 live images where some installed fonts appear to be missing from the fontconfig cache in the live environment. An 'fc-cache -f' fixes this. For instance, on the Fedora 21 Final RC2 Workstation x86_64 live:

[root@localhost liveuser]# fc-list | wc -l
141
[root@localhost liveuser]# fc-cache --force
[root@localhost liveuser]# fc-list | wc -l
159

The specific fonts that are missing on that image are:

/usr/share/fonts/dejavu/DejaVuSansMono-BoldOblique.ttf: DejaVu Sans Mono:style=Bold Oblique
/usr/share/fonts/dejavu/DejaVuSansMono-Bold.ttf: DejaVu Sans Mono:style=Bold
/usr/share/fonts/dejavu/DejaVuSansMono-Oblique.ttf: DejaVu Sans Mono:style=Oblique
/usr/share/fonts/dejavu/DejaVuSansMono.ttf: DejaVu Sans Mono:style=Book

/usr/share/fonts/dejavu/DejaVuSerif-BoldItalic.ttf: DejaVu Serif:style=Bold Italic
/usr/share/fonts/dejavu/DejaVuSerif-Bold.ttf: DejaVu Serif:style=Bold
/usr/share/fonts/dejavu/DejaVuSerifCondensed-BoldItalic.ttf: DejaVu Serif,DejaVu Serif Condensed:style=Condensed Bold Italic,Bold Italic

/usr/share/fonts/dejavu/DejaVuSerifCondensed.ttf: DejaVu Serif,DejaVu Serif Condensed:style=Condensed,Book
/usr/share/fonts/dejavu/DejaVuSerif-Italic.ttf: DejaVu Serif:style=Italic
/usr/share/fonts/dejavu/DejaVuSerif.ttf: DejaVu Serif:style=Book

/usr/share/fonts/google-noto/NotoSansTagalog-Regular.ttf: Noto Sans Tagalog:style=Regular
/usr/share/fonts/google-noto/NotoSansTaiViet-Regular.ttf: Noto Sans Tai Viet:style=Regular

/usr/share/fonts/liberation/LiberationSerif-BoldItalic.ttf: Liberation Serif:style=Bold Italic
/usr/share/fonts/liberation/LiberationSerif-Bold.ttf: Liberation Serif:style=Bold
/usr/share/fonts/liberation/LiberationSerif-Italic.ttf: Liberation Serif:style=Italic
/usr/share/fonts/liberation/LiberationSerif-Regular.ttf: Liberation Serif:style=Regular

The log of the compose is here:

https://kojipkgs.fedoraproject.org//work/tasks/5463/8275463/root.log

In comparison, the i686 Workstation live is 'missing' only

/usr/share/fonts/google-noto/NotoSansTaiViet-Regular.ttf: Noto Sans Tai Viet:style=Regular

its compose log is here:

https://kojipkgs.fedoraproject.org//work/tasks/5460/8275460/root.log

to me, it appears the affected cases are ones where more than one package contains fonts in the same directory, for packages installed *after* the fontconfig package. The fontconfig package has an 'fc-cache -f' in its %post, so any inconsistencies that exist before it's installed get fixed by that.

My first thesis was 'for any given directory, only fonts from the first package installed after fontconfig will make it to the cache, fonts in the same directory from subsequently-installed packages won't be added'. But it doesn't seem to be that simple, because some fonts in /usr/share/fonts/google-noto *are* added - the first 'noto' package installed is google-noto-sans-lisu-fonts , and after that several more noto packages are installed. The fonts from google-noto-sans-mandaic-fonts, google-noto-sans-meeteimayek-fonts , and google-noto-sans-tai-tham-fonts *do* get added to the cache - but the fonts from google-noto-sans-tagalog-fonts and google-noto-sans-tai-viet-fonts do *not* get added. It's quite odd.

This is a fairly bad bug because of its impact on DejaVu Sans Mono: this is the default monospace font for both Workstation and KDE (and I think the non-blocking spins too). Its absence from the cache results in them using Nimbus Mono L as their monospace fonts, which is a pretty crappy font, ugly and hard to read. The workaround is easy once you know it, but if you don't, you just think we have a really bad font.

There's an easy big hammer workaround we can use for a quick rebuild of the RC2 lives, if we like:

--- a/fedora-live-base.ks
+++ b/fedora-live-base.ks
@@ -299,6 +299,12 @@ rm -f /core*
 # convince readahead not to collect
 # FIXME: for systemd
 
+# forcibly regenerate fontconfig cache (so long as this live image has
+# fontconfig) - see #XXXXXXX
+if [ -x /usr/bin/fc-cache ] ; then
+   fc-cache -f
+fi
+
 %end

i.e., just do an fc-cache -f at the end of live generation %post. I've tested that locally, and it works, the generated Workstation image has 159 fonts in fc-list (I also generated an image with the exact same config and build host, but no change to spin-kickstarts, to verify that it reproduced the bug, and it does).

The real fix should likely be in fc-cache, but the spin-kickstarts workaround would solve this problem for F21.

I think fc-cache's behaviour must have changed between F20 and F21, as F20 doesn't appear to be affected by this at all, at least not the x86_64 desktop live. All F21 images I've tested seem to be affected to some extent, though the exact affected fonts vary depending on the package install order that yum decided on.

Comment 1 Adam Williamson 2014-12-02 22:08:09 UTC
Created attachment 963917 [details]
F21 Workstation with the good font (DejaVu Sans Mono)

Comment 2 Adam Williamson 2014-12-02 22:10:04 UTC
Created attachment 963919 [details]
F21 Workstation with the bad font (Nimbus Mono L)

To give an idea of the practical impact of this bug on Fedora 21 Final RC2, see these screenshots - one with the font that ought to be used (DejaVu Sans Mono), one with the font that winds up getting used (Nimbus Mono L).

Comment 3 Fedora Blocker Bugs Application 2014-12-02 22:50:58 UTC
Proposed as a Freeze Exception for 21-final by Fedora user catanzaro using the blocker tracking app because:

 Would be sweet to use the big hammer workaround proposed in comment #0; that seems safe enough for this stage in the game and would.

Comment 4 Adam Williamson 2014-12-02 22:55:00 UTC
I was actually angling to just ninja this one in as all it requires is a spin-kickstarts change, but +1 FE. We do have the option of firing a complete RC3 for the spin-kickstarts fix (even though non-lives would not be affected at all) and then we can decide what to do with rc2 and rc3 on Thursday.

I just tested a Workstation network install, as it seems plausible that regular installs could suffer from this too. It was fine. I suspect perhaps the time taken to download packages helps, if we're figuring this is some kinda timing issue with fc-cache. live image creation retrieves all the packages first; network installation downloads packages one at a time during the install process. So, perhaps a network install over a local network might hit it.

Comment 5 Adam Williamson 2014-12-02 23:01:42 UTC
I'm gonna count this from rdieter as a +1 FE:

<rdieter> oh my bad, sorry.  use big hammer, yes
<rdieter> go forth, and hammer like youve never hammered before
<rdieter> make thor proud

also from roshi:

<roshi> I'm for respinning the lives

so let's call this AcceptedFreezeException at this point.

Comment 6 Adam Williamson 2014-12-03 06:11:53 UTC
I grabbed RC4 Workstation x64 and verified the fc-list count doesn't change with an `fc-cache -f`. And Terminal uses the correct font.

Comment 7 Adam Williamson 2014-12-04 23:56:09 UTC
This is verified addressed via the spin-kickstarts workaround in F21 Final, however, the underlying bug in font-config and possibly scriptlets must still be there. So I'm dropping the FE status markers and setting bug to ASSIGNED.

Comment 8 Rob Foehl 2014-12-16 05:44:43 UTC
(In reply to Adam Williamson (Red Hat) from comment #4)
> I just tested a Workstation network install, as it seems plausible that
> regular installs could suffer from this too. It was fine. I suspect perhaps
> the time taken to download packages helps, if we're figuring this is some
> kinda timing issue with fc-cache. live image creation retrieves all the
> packages first; network installation downloads packages one at a time during
> the install process. So, perhaps a network install over a local network
> might hit it.

I just ran into this issue with one of two desktops that were built up from minimal network installs and an "add just the stuff I need" script: after installing the @fonts group (among other things), one had Nimbus Mono L as the only available monospace font, before manually running fc-cache -f.  The other system was fine, which seems to confirm your suspicion above.

Is there a fontconfig bug open anywhere for this?  I've been using this same basic process for (re)installs since FC3, and was blissfully unaware of the fontconfig cache until now...

-Rob

Comment 9 Adam Williamson 2014-12-16 07:35:08 UTC
"Is there a fontconfig bug open anywhere for this?"

This is it - this bug is assigned to fontconfig.

Comment 10 Akira TAGOH 2014-12-16 08:29:09 UTC
it has some workarounds to avoid similar situations but I have no idea why it happened at this moment.

Comment 11 Adam Williamson 2014-12-16 15:59:14 UTC
Akira: I can at least say that it seems definitely to have changed somehow between 20 and 21. I test booted several F20 Final, Alpha and Beta live images and none of them displayed the problem.

Comment 12 Akira TAGOH 2014-12-17 03:08:44 UTC
(In reply to Adam Williamson (Red Hat) from comment #11)
> Akira: I can at least say that it seems definitely to have changed somehow
> between 20 and 21. I test booted several F20 Final, Alpha and Beta live
> images and none of them displayed the problem.

not really. 2.11.0 also had that issue. it just happened to work for f20 fortunately or unfortunately.

Comment 13 Adam Williamson 2014-12-17 03:11:30 UTC
I find that hard to believe, the chances would be astronomical. *Every* F21 live compose I checked, going back to Beta, had the bug. *Every* F20 live compose I checked did not.

I can believe the F20 version had some issues in this area, but I don't believe it had the specific issue that affects the live compose scenario.

Comment 14 Rex Dieter 2014-12-17 14:39:36 UTC
Akira, is there some way to force cache invalidation for a folder, set, or particular font?  If so, we could use that technique in our font-related rpm scriptlets to make this more reliable.

Comment 15 Akira TAGOH 2014-12-24 11:30:01 UTC
-f option do as we did for a workaround like the above.

Comment 16 Andrew Clayton 2015-06-27 17:56:31 UTC
This (or something very similar) seems to be affecting Fedora 22 also (netinst install)

$ rpm -qa dejavu-sans-mono-fonts
dejavu-sans-mono-fonts-2.35-1.fc22.noarch

$ fc-match monospace
n022003l.pfb: "Nimbus Mono L" "Regular"

$ sudo fc-cache -f

$ fc-match monospace
DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"

Comment 17 Andrew Clayton 2015-06-27 18:04:04 UTC
BTW, re-installing the rpm also fix's it.

Comment 18 Adam Williamson 2015-10-22 17:57:11 UTC
Maybe we can drop the kickstart workaround from rawhide spin-kickstarts and see if it's OK now, if I'm following #1236034 correctly?

Comment 19 Akira TAGOH 2015-10-23 03:59:22 UTC
Yes, please.

Comment 20 Fedora End Of Life 2015-11-04 15:19:06 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '21'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 21 Adam Williamson 2015-11-04 20:55:50 UTC
OK, I'm gonna bump this to Rawhide and drop the workaround from Rawhide spin-kickstarts, and we can close it if things still look good after that.

Comment 23 Jan Kurik 2016-02-24 13:17:37 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 24 development cycle.
Changing version to '24'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora24#Rawhide_Rebase

Comment 24 Akira TAGOH 2016-06-10 06:44:42 UTC
I guess this can be closed now?

Comment 25 Akira TAGOH 2016-06-10 06:46:16 UTC
that would be nice to test on f24 and rawhide as well because there has been made some changes in that area between f24's and rawhide's.

Comment 26 Adam Williamson 2016-06-10 06:50:04 UTC
I haven't noticed any such issues on F24 yet, I think closing for now is fine. Will re-open or file a new bug if problems show up again.


Note You need to log in before you can comment on or make changes to this bug.