[Fontconfig] Status about fontconfig CVS regarding cache handling

Frederic Crozat fcrozat at mandriva.com
Thu Feb 16 05:04:21 PST 2006


Le jeudi 16 février 2006 à 01:27 -0500, Patrick Lam a écrit :
> Frederic Crozat wrote:
> > Le jeudi 09 février 2006 à 13:39 -0500, Patrick Lam a écrit :
> > 
> >>Frederic Crozat wrote:
> >>
> >>>But old fonts.cache-2 file in the file system (not
> >>>in /var/cache/fontconfig) is not removed when running fc-cache and
> >>>running fc-cache several times still update cache
> >>>in /var/cache/fontconfig.
> > 
> > Hmm, I thought the problem would be fixed by patch from Takashi
> > preferring /var/cache/fontconfig files instead of the one in directory
> > but it still isn't. 
> 
> The code removes the fonts.cache-2 file in the directory and then the 
> hashed cache file, and I've confirmed this behaviour.  I've committed an 
> additional patch which makes it not bail if it sees a fonts.cache-2 and 
> fails to remove it; this is sort of inconvenient, but fontconfig can 
> live with it.

Well, I've just tested here with today CVS snapshot
and /usr/share/fonts/ttf/big5/fonts.cache-2 is never removed, when
running fc-cache or fc-cache -f :( (and /usr is not read-only).

I've checked fc-cache.c code a little more :

FcDirCacheUnlink is only called when FcDirCacheValid is false.
Unfortunately, in my case, cache in /var/cache/fontconfig is always
valid, so FcDirCacheValid returns always TRUE and therefore
FcDirCacheUnlink is not called and doesn't remove the old cache
in /usr/share/fonts/ttf/big5/.

And this "bug" seems even documented in FcDirCacheValid : 
* Also, this can be fooled if the original location has a stale
 * cache, and the hashed location has an up-to-date cache.  Oh well,
 * sucks to be you in that case! */

I think we should try to really nail that bug, otherwise people will end
with unstable cache behaviour. Maybe adding a "--remove-obsolete-cache"
option to fc-cache to remove fonts.cache-2 outside /var/cache/fontconfig
would be a solution (and it could remove fonts.cache-1 too if we want ;)

> Here's a bug that probably already exists in 2.3.2 but is only important 
> now: if you mount /usr as read-only, then fc-cache skips generating 
> caches in /var since it thinks it doesn't have access to /usr and won't 
> be able to generate caches.
> 
> > Running fc-cache several times still generate recreate cache
> > in /var/cache/fontconfig.
> > 
> > I guess there is still some side effect somewhere..
> 
> I can't trigger this part of the bug.  For me it erases the 
> fonts.cache-2 file, or triggers the bug I mentioned above.

I hope my hints helped you understanding my problem (and your fix for
the /usr read-only bug didn't fix my bug..).

PS : be careful when replying, your initial reply wasn't sent to the
list.
-- 
Frederic Crozat <fcrozat at mandriva.com>
Mandriva



More information about the Fontconfig mailing list