[Fontconfig] patch: crosscheck font caches

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I can't reproduce the broken-cache problem on my computer, although I
can verify that the broken caches that other people send me are indeed
broken.  I don't know when this corruption is occuring; note that it
also throws out all the strings and langsets in the cache file.  This
patch adds an assertion that will abort fc-cache when it's trying to
write a corrupted cache file.  If some of the people experiencing
corrupted caches could try this patch and tell me under what
circumstances corruption is happening, that would help a lot, because
I'm somewhat at a loss.

Is there any chance that some other application (not fc-cache) is
modifying the fonts.cache-2 file?  That would be weird and inexplicable.
 Mail me if you have any ideas.

pat

Index: src/fccache.c
===================================================================
RCS file: /cvs/fontconfig/fontconfig/src/fccache.c,v
retrieving revision 1.23.4.28
diff -u -r1.23.4.28 fccache.c
--- src/fccache.c       21 Oct 2005 20:24:30 -0000      1.23.4.28
+++ src/fccache.c       31 Oct 2005 15:08:37 -0000
@@ -808,6 +808,8 @@
     if (!FcFontSetSerialize (bank, set))
        goto bail;

+    FcCharSetCrossCheck(bank);
+
     return current_dir_block;

  bail:
Index: src/fccharset.c
===================================================================
RCS file: /cvs/fontconfig/fontconfig/src/fccharset.c,v
retrieving revision 1.25.4.4
diff -u -r1.25.4.4 fccharset.c
--- src/fccharset.c     22 Sep 2005 23:45:53 -0000      1.25.4.4
+++ src/fccharset.c     31 Oct 2005 15:08:37 -0000
@@ -1425,6 +1425,20 @@
     return block_ptr;
 }

+void
+FcCharSetCrossCheck (int bank)
+{
+    int bi = FcCacheBankToIndex(bank);
+    int i;
+
+    for (i = 0; i < charset_ptr; i++)
+       if (charsets[bi][i].ref != FC_REF_CONSTANT)
+       {
+           printf ("ERROR! BAD CHARSET!  PLEASE INFORM plam@xxxxxxx!\n");
+           abort();
+       }
+}
+
 FcCharLeaf *
 FcCharSetGetLeaf(const FcCharSet *c, int i)
 {
Index: src/fcint.h
===================================================================
RCS file: /cvs/fontconfig/fontconfig/src/fcint.h,v
retrieving revision 1.47.4.15
diff -u -r1.47.4.15 fcint.h
--- src/fcint.h 22 Oct 2005 14:21:14 -0000      1.47.4.15
+++ src/fcint.h 31 Oct 2005 15:08:37 -0000
@@ -549,6 +549,9 @@
 FcChar16 *
 FcCharSetGetNumbers(const FcCharSet *c);

+void
+FcCharSetCrossCheck (int bank);
+
 /* fcdbg.c */
 void
 FcValueListPrint (const FcValueListPtr l);


[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux