[Fontconfig] Trouble forcing rescanning of font dirs

Diego Santa Cruz Diego.SantaCruz at spinetix.com
Mon Feb 2 06:47:37 PST 2009

> -----Original Message-----
> From: fontconfig-bounces at lists.freedesktop.org [mailto:fontconfig-
> bounces at lists.freedesktop.org] On Behalf Of Diego Santa Cruz
> I am testing my proposed fix and will let you know how it goes

Please find attached my proposed fix. As far as I could test it does
work as intended.

However, we have hit two more problems once fontconfig realizes that the
cache file is outdated and builds a new one.

1. When fontconfig builds a cache it inserts it into the cache chain
with cache_dev, cache_ino and cache_mtime all set to zero, since the
cache is not yet on disk. However, when the cache is finally written to
disk by FcDirCacheWrite() the fields in the cache chain are not updated.
The effect is that any later FcCacheFindByStat() on the same font
directory will fail because the cache_{dev,ino,mtime} cannot match,
resulting in reloading yet again the cache files. Would doing a stat
just before FcAtomicReplaceOrig() and inserting these fields into the
cache chain if FcAtomicReplaceOrig() succeeds be OK?

2. Under Windows the FcAtomicReplaceOrig() always fails if the cache
file is loaded somewhere. In fact, unlink and rename fail if the (old)
file is mmaped by someone (which often is the same app). I think that,
under Windows, if unlink() fails we should try to rename the old file to
some other name, and then rename the new cache file to the correct cache
name. Note that under Windows an open or mmaped file can be renamed, at
least within the same directory. This however runs the risk of leaving
files behind, but well its Windows... Any other ideas?



Diego Santa Cruz, PhD
Technology Architect
SpinetiX S.A.
Rue des Terreaux 17
1003, Lausanne, Switzerland
T +41 21 341 15 50
F +41 21 311 19 56
diego.santacruz at spinetix.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: fccache-valid-mtime.patch
Type: application/octet-stream
Size: 578 bytes
Desc: fccache-valid-mtime.patch
Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20090202/33e140fc/attachment.obj 

More information about the Fontconfig mailing list