[Fontconfig] Re: Status about fontconfig CVS regarding cache handling

Mike FABIAN mfabian at suse.de
Fri Feb 17 09:34:23 PST 2006


Mike FABIAN <mfabian at suse.de> さんは書きました:

> Frederic Crozat <fcrozat at mandriva.com> さんは書きました:
>
>> Le vendredi 17 février 2006 à 10:22 -0500, Patrick Lam a écrit :
>>> Frederic Crozat wrote:
>>> > Le vendredi 17 février 2006 à 09:48 -0500, Patrick Lam a écrit :
>>> > 
>>> >>Frederic Crozat wrote:
>>> >>
>>> >>>Not really, now it crashes when starting fc-cache -v :
>>> >>
>>> >>That's probably due to the change in cache file format without a change 
>>> >>in MAGIC.  I've now bumped up MAGIC to 0xFC02FC03.  Your fontconfig 
>>> >>shouldn't crash anymore.
>>> > 
>>> > Well, it still does with updated code (same stack).
>>> 
>>> What if you blow away the cache files?
>>
>> If I remove the affected cache, fc-cache is able to update cache for
>> this directory and crashes on one of the next directory :)
>>
>> I've attached the offending file (be careful, it is renamed).
>
> I see the same crashes Frederic sees with the same backtrace.
>
> I can easily reproduce it like this (as root):
>
>     root at magellan:~# rm -f /var/cache/fontconfig/* ~/.fonts.cache-2
>     root at magellan:~# fc-cache -v
>     fc-cache: "/usr/share/fonts": caching, 0 fonts, 3 dirs

[...]

>     fc-cache: "/usr/X11R6/lib/Acrobat7/Resource/Font/PFM": caching, 0 fonts, 0 dirs
>     fc-cache: succeeded
>     root at magellan:~# fc-cache -v
>     fc-cache: "/usr/share/fonts": caching, 0 fonts, 3 dirs
>     fc-cache: "/usr/share/fonts/bdf": caching, 0 fonts, 0 dirs
>     fc-cache: "/usr/share/fonts": skipping, looped directory detected
>     fc-cache: "/usr/share/fonts/wine": caching, 1 fonts, 0 dirs
>     fc-cache: "/usr/X11R6/lib/X11/fonts": caching, 0 fonts, 24 dirs
>     fc-cache: "/usr/X11R6/lib/X11/fonts/japanese": caching, 30 fonts, 0 dirs
>     セグメンテーション違反です (core dumped)
>     root at magellan:~# 
>
> I.e. when running "fc-cache -v" the second time, it dumps core.
> Of course the magic numbers in the cache files are correct already,
> they are all 0xFC02FC03 (latest CVS).
>
> Note that during the second run of "fc-cache -v" it always writes
> "caching" instead of "skipping" to standard output.  I.e. it doesn't
> seem to notice that the cache files are already up-to-date.

In gdb I see that FcDirCacheHasCurrentArch () always returns FcFalse.

In the following piece of code from FcDirCacheHasCurrentArch ():

        if (read(fd, &metadata, sizeof(FcCache)) != sizeof(FcCache))
        {
            close (fd);
            return FcFalse;
        }

        if (metadata.magic != FC_CACHE_MAGIC)
        {
            close (fd);
            return FcFalse;
        }

it seems to read complete junk into "metadata", gdb shows me:

    (gdb) p/x metadata
    $9 = {magic = 0x7273752f, count = 0x6168732f, bank = 0x662f6572,
      pattern_count = 0x73746e6f, patternelt_count = 0x6664622f,
      valuelist_count = 0x73752f00, str_count = 0x68732f72,
      langset_count = 0x2f657261, charset_count = 0x746e6f66,
      charset_numbers_count = 0x74742f73, charset_leaf_count = 0x752f0074,

      charset_leaf_idx_count = 0x732f7273}
    (gdb)

and then of course

   if (metadata.magic != FC_CACHE_MAGIC)

is true and it returns with FcFalse;

-- 
Mike FABIAN   <mfabian at suse.de>   http://www.suse.de/~mfabian
睡眠不足はいい仕事の敵だ。



More information about the Fontconfig mailing list