Mike FABIAN
2006-Jan-31 10:45 UTC
[Fontconfig] patch to improve FcConfigNormalizeFontDir ()
Patch by Takashi IWAI <tiwai@suse.de> (CC:): If FcConfigNormalizeFontDir () was called with a directory which is not a subdirectory of a directory from a .conf file, the list of all subdirectories was added to the list of known directories. When doing this again, the list of subdirectories was added again. Takashi''s patch fixes this. -------------- next part -------------- A non-text attachment was scrubbed... Name: fontconfig-fontsubdir-parse-fix.diff Type: text/x-patch Size: 3411 bytes Desc: not available Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20060131/dc5990b1/fontconfig-fontsubdir-parse-fix-0001.bin -------------- next part -------------- -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ?????????????
Mike FABIAN
2006-Jan-31 10:47 UTC
[Fontconfig] Re: patch to improve FcConfigNormalizeFontDir ()
Patch by Takashi IWAI <tiwai@suse.de> (CC:) to check the return values of read (), write (), and lseek () and fix some other compiler warnings. Should make the code more robust. -------------- next part -------------- A non-text attachment was scrubbed... Name: fontconfig-misc-warning-fixes.diff Type: text/x-patch Size: 4915 bytes Desc: not available Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20060131/43e39ad1/fontconfig-misc-warning-fixes.bin -------------- next part -------------- -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ?????????????
Patch by Takashi Iwai <tiwai@suse.de> to fix a memory leak. -------------- next part -------------- A non-text attachment was scrubbed... Name: fontconfig-memleak-fix.diff Type: text/x-patch Size: 425 bytes Desc: not available Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20060131/1593b7cf/fontconfig-memleak-fix.bin -------------- next part -------------- -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ?????????????
Patch by Takashi Iwai <tiwai@suse.de>: -------------- next part -------------- A non-text attachment was scrubbed... Name: fccache-update-check.diff Type: text/x-patch Size: 1235 bytes Desc: not available Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20060131/37d9f431/fccache-update-check.bin -------------- next part -------------- -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ?????????????
Mike FABIAN
2006-Jan-31 11:45 UTC
[Fontconfig] another type of broken ~/.fonts.cache-2 file
http://lisa.goe.net/~mfabian/.fonts.cache-2.bad http://lisa.goe.net/~mfabian/.fonts.cache-2.good Both have the same size: mfabian@lisa:~/public_html$ ll .fonts.cache-2.* -rw-r--r-- 1 mfabian users 4902913 2006-01-31 20:37 .fonts.cache-2.bad -rw-r--r-- 1 mfabian users 4902913 2006-01-31 20:37 .fonts.cache-2.good mfabian@lisa:~/public_html$ and the fc-cat output for both of them is identical. If I copy .fonts.cache-2.good to ~/.fonts.cache-2, it works. If I copy .fonts.cache-2.bad to ~/.fonts.cache-2, "fc-match sans" seems to loop endlessly, eating up system resources until it finally dumps core. The strace shows that it loops over the same font directories again and again. Locking with "hex" into ~/.fonts.cache-2.bad reveals that it contains a list of all the font directories again, which probably leads to the endless recursion (from offset 0x1000): 1000 2f 68 6f 6d 65 2f 6d 66 61 62 69 61 6e 2f 2e 66 /home/mf abian/.f 1010 6f 6e 74 73 00 2f 75 73 72 2f 73 68 61 72 65 2f onts./us r/share/ 1020 66 6f 6e 74 73 00 2f 75 73 72 2f 58 31 31 52 36 fonts./u sr/X11R6 1030 2f 6c 69 62 2f 58 31 31 2f 66 6f 6e 74 73 00 2f /lib/X11 /fonts./ 1040 6f 70 74 2f 6b 64 65 33 2f 73 68 61 72 65 2f 66 opt/kde3 /share/f 1050 6f 6e 74 73 00 2f 75 73 72 2f 6c 69 62 2f 6f 6f onts./us r/lib/oo 1060 6f 2d 32 2e 30 2f 73 68 61 72 65 2f 66 6f 6e 74 o-2.0/sh are/font 1070 73 00 2f 75 73 72 2f 6c 69 62 2f 6f 6f 6f 2d 31 s./usr/l ib/ooo-1 1080 2e 31 2f 73 68 61 72 65 2f 66 6f 6e 74 73 00 2f .1/share /fonts./ 1090 6f 70 74 2f 4f 70 65 6e 4f 66 66 69 63 65 2e 6f opt/Open Office.o 10a0 72 67 2f 73 68 61 72 65 2f 66 6f 6e 74 73 00 2f rg/share /fonts./ 10b0 6f 70 74 2f 73 74 61 72 6f 66 66 69 63 65 36 2e opt/star office6. 10c0 30 2f 73 68 61 72 65 2f 66 6f 6e 74 73 00 2f 75 0/share/ fonts./u 10d0 73 72 2f 6c 69 62 36 34 2f 6a 76 6d 2f 6a 61 76 sr/lib64 /jvm/jav 10e0 61 2d 31 2e 35 2e 30 2d 73 75 6e 2d 31 2e 35 2e a-1.5.0- sun-1.5. 10f0 30 5f 30 31 2f 6a 72 65 2f 6c 69 62 2f 66 6f 6e 0_01/jre /lib/fon 1100 74 73 00 2f 75 73 72 2f 6c 69 62 2f 6a 76 6d 2f ts./usr/ lib/jvm/ 1110 6a 61 76 61 2d 31 2e 35 2e 30 2d 73 75 6e 2d 31 java-1.5 .0-sun-1 1120 2e 35 2e 30 5f 30 31 2f 6a 72 65 2f 6c 69 62 2f .5.0_01/ jre/lib/ 1130 66 6f 6e 74 73 00 2f 75 73 72 2f 6c 69 62 2f 6a fonts./u sr/lib/j 1140 76 6d 2f 6a 61 76 61 2d 31 2e 34 2e 32 2d 73 75 vm/java- 1.4.2-su 1150 6e 2d 31 2e 34 2e 32 2e 30 36 2f 6a 72 65 2f 6c n-1.4.2. 06/jre/l 1160 69 62 2f 66 6f 6e 74 73 00 2f 75 73 72 2f 6c 69 ib/fonts ./usr/li 1170 62 2f 6a 76 6d 2f 6a 61 76 61 2d 31 5f 34 5f 32 b/jvm/ja va-1_4_2 1180 2d 73 75 6e 2d 31 2e 34 2e 32 2e 31 30 2f 6a 72 -sun-1.4 .2.10/jr 1190 65 2f 6c 69 62 2f 66 6f 6e 74 73 00 2f 75 73 72 e/lib/fo nts./usr 11a0 2f 58 31 31 52 36 2f 6c 69 62 2f 41 63 72 6f 62 /X11R6/l ib/Acrob 11b0 61 74 37 2f 52 65 73 6f 75 72 63 65 2f 46 6f 6e at7/Reso urce/Fon 11c0 74 00 2f 75 73 72 2f 6c 6f 63 61 6c 2f 73 68 61 t./usr/l ocal/sha 11d0 72 65 2f 66 6f 6e 74 73 2f 00 2f 68 6f 6d 65 2f re/fonts /./home/ 11e0 6d 66 61 62 69 61 6e 2f 2e 66 6f 6e 74 73 00 2f mfabian/ .fonts./ 11f0 75 73 72 2f 73 68 61 72 65 2f 66 6f 6e 74 73 2f usr/shar e/fonts/ ~/.fonts.cache-2.good only contains the directories "/home/mfabian/.fonts" and "/home/mfabian/.fonts/kde-override" at offset 0x1000: 1000 2f 68 6f 6d 65 2f 6d 66 61 62 69 61 6e 2f 2e 66 /home/mf abian/.f 1010 6f 6e 74 73 00 2f 68 6f 6d 65 2f 6d 66 61 62 69 onts./ho me/mfabi 1020 61 6e 2f 2e 66 6f 6e 74 73 2f 6b 64 65 2d 6f 76 an/.font s/kde-ov 1030 65 72 72 69 64 65 00 00 02 fc 02 fc a1 52 03 00 erride.. .....R.. 1040 01 10 f9 26 41 00 00 00 0c 04 00 00 be 04 00 00 ...&A... ........ 1050 52 0a 00 00 41 00 00 00 41 00 00 00 7c 0f 00 00 R...A... A...|... 1060 7c 0f 00 00 41 00 00 00 00 00 00 00 00 00 00 00 |...A... ........ 1070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 1080 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ I have no idea how ~/.fonts.cache-2.bad was created. -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ?????????????
Patrick Lam
2006-Jan-31 22:41 UTC
[Fontconfig] Re: patch to improve FcConfigNormalizeFontDir ()
Mike FABIAN wrote:> Patch by Takashi IWAI <tiwai@suse.de> (CC:): > > If FcConfigNormalizeFontDir () was called with a directory > which is not a subdirectory of a directory from a .conf file, > the list of all subdirectories was added to the list of known > directories. When doing this again, the list of subdirectories > was added again. Takashi''s patch fixes this.Thanks for the patches. Unfortunately, until Friday thesis-writing has precedence over patch review. I should be able to commit these patches on Friday though. pat
Mike FABIAN <mfabian@suse.de> ????????:> Patch by Takashi Iwai <tiwai@suse.de>:This patch is obsolete, Takashi made a better one yesterday. Attached. -------------- next part -------------- A non-text attachment was scrubbed... Name: fccache-update-check.diff Type: text/x-patch Size: 9993 bytes Desc: not available Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20060202/8c8decd4/fccache-update-check.bin -------------- next part -------------- -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ?????????????
by Takashi Iwai <tiwai@suse.de>. fc-cache did loop endless if a subdirectory was a symlink pointing to a directory higher up, e.g. ln -s /usr/share/fonts /usr/share/fonts/ttt -------------- next part -------------- A non-text attachment was scrubbed... Name: fc-cache-loop-fix.diff Type: text/x-patch Size: 1248 bytes Desc: not available Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20060203/5157a309/fc-cache-loop-fix.bin -------------- next part -------------- -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ?????????????
Mike FABIAN wrote:> Patch by Takashi Iwai <tiwai@suse.de> to fix a memory leak.Thanks, it''s committed now. pat
Patrick Lam
2006-Feb-04 18:57 UTC
[Fontconfig] Re: patch to improve FcConfigNormalizeFontDir ()
Mike FABIAN wrote:> Patch by Takashi IWAI <tiwai@suse.de> (CC:) to check the return values > of read (), write (), and lseek () and fix some other compiler > warnings. Should make the code more robust.Looks good to me (although we don''t use perror much in fontconfig). I''ve committed it. pat
Patrick Lam
2006-Feb-06 06:26 UTC
[Fontconfig] another type of broken ~/.fonts.cache-2 file
Mike FABIAN wrote:> If I copy .fonts.cache-2.bad to ~/.fonts.cache-2, > "fc-match sans" seems to loop endlessly, eating up system > resources until it finally dumps core....> I have no idea how ~/.fonts.cache-2.bad was created.I was experiencing a similar problem and tried to reproduce it all yesterday afternoon[1]. My problem was as follows: 1. make clean; make; make install 2. rm /var/cache/fontconfig/* 3. fc-list 4. fc-list The second fc-list used to loop. But it doesn''t seem to loop anymore. I then tried to trace down the commit that made it not loop, but didn''t succeed, which makes me a bit suspicious. I''ll putz around with it a bit more today, but I suspect that it is gone. Hopefully I can figure out which commit fixed it. pat [1] I seem to lack sufficient amounts of CVS-fu to make it really easy to binary search on a branch; cvs diff -rfc-2_4_branch -D2006-02-04 doesn''t have the desired effect. SVN is kind of better that way...
Mike FABIAN <mfabian@suse.de> ????????:> by Takashi Iwai <tiwai@suse.de>. > > fc-cache did loop endless if a subdirectory was a symlink > pointing to a directory higher up, e.g. > ln -s /usr/share/fonts /usr/share/fonts/tttIn addition to that patch for "fc-cache.c", another, similar patch is also necessary for "fccache.c", otherwise applications using fontconfig will still loop. The patch attached is also by Takashi Iwai <tiwai@suse.de>. -------------- next part -------------- A non-text attachment was scrubbed... Name: fc-loop-scan-fix.diff Type: text/x-patch Size: 1378 bytes Desc: not available Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20060206/afc65158/fc-loop-scan-fix.bin -------------- next part -------------- -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ?????????????
Mike FABIAN wrote:> Mike FABIAN <mfabian@suse.de> ????????: > > >>by Takashi Iwai <tiwai@suse.de>. >> >>fc-cache did loop endless if a subdirectory was a symlink >>pointing to a directory higher up, e.g. >>ln -s /usr/share/fonts /usr/share/fonts/ttt > > > In addition to that patch for "fc-cache.c", another, similar patch > is also necessary for "fccache.c", otherwise applications using > fontconfig will still loop.The call to FcStrSetMember in FcCacheReadDirs is unneeded (here and elsewhere), because FcStrSetAdd calls _FcStrSetAppend, which starts with: if (FcStrSetMember (set, s)) { FcStrFree (s); return FcTrue; } Also it would be good to avoid having this difficult-to-understand global processed_dirs variable. I''d much rather have it be passed to FcCacheReadDirs. Once I review Takashi''s first patch (hopefully later today) I''ll commit a modified version of this patch. pat
Patrick Lam
2006-Feb-06 11:26 UTC
[Fontconfig] Re: patch to improve FcConfigNormalizeFontDir ()
Mike FABIAN wrote:> Patch by Takashi IWAI <tiwai@suse.de> (CC:): > > If FcConfigNormalizeFontDir () was called with a directory > which is not a subdirectory of a directory from a .conf file, > the list of all subdirectories was added to the list of known > directories. When doing this again, the list of subdirectories > was added again. Takashi''s patch fixes this.I''ve committed this patch (slightly modified). pat
Mike FABIAN wrote:> Mike FABIAN <mfabian@suse.de> ????????: > > >>Patch by Takashi Iwai <tiwai@suse.de>: > > > This patch is obsolete, Takashi made a better one yesterday.Ok, this patch looks good and doesn''t appear to break my system. I''ve committed it. BTW, fontconfig style seems to generally have { on separate lines. Let''s try to keep the same style throughout. pat
Mike FABIAN wrote:> by Takashi Iwai <tiwai@suse.de>. > > fc-cache did loop endless if a subdirectory was a symlink > pointing to a directory higher up, e.g. > ln -s /usr/share/fonts /usr/share/fonts/tttI''ve committed this patch. The other patch doesn''t seem to be necessary; fontconfig-using apps don''t crash for me (whether or not they''re creating global caches) when there''s a symlink cycle in the directory structure. pat
Mike FABIAN wrote:> Mike FABIAN <mfabian@suse.de> ????????: > > >>by Takashi Iwai <tiwai@suse.de>. >> >>fc-cache did loop endless if a subdirectory was a symlink >>pointing to a directory higher up, e.g. >>ln -s /usr/share/fonts /usr/share/fonts/ttt > > > In addition to that patch for "fc-cache.c", another, similar patch > is also necessary for "fccache.c", otherwise applications using > fontconfig will still loop.Ok, I''ve committed (a variant of) this patch. pat
Patrick Lam <plam@MIT.EDU> ????????:> Mike FABIAN wrote: >> by Takashi Iwai <tiwai@suse.de>. >> >> fc-cache did loop endless if a subdirectory was a symlink >> pointing to a directory higher up, e.g. >> ln -s /usr/share/fonts /usr/share/fonts/ttt > > I''ve committed this patch. The other patch doesn''t seem to be > necessary; fontconfig-using apps don''t crash for me (whether or not > they''re creating global caches) when there''s a symlink cycle in the > directory structure.It looks like you have committed both patches to CVS. And I think both were indeed necessary. -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ?????????????
Mike FABIAN wrote:> Patrick Lam <plam@MIT.EDU> ????????: > > >>Mike FABIAN wrote: >> >>>by Takashi Iwai <tiwai@suse.de>. >>> >>>fc-cache did loop endless if a subdirectory was a symlink >>>pointing to a directory higher up, e.g. >>>ln -s /usr/share/fonts /usr/share/fonts/ttt >> >>I''ve committed this patch. The other patch doesn''t seem to be >>necessary; fontconfig-using apps don''t crash for me (whether or not >>they''re creating global caches) when there''s a symlink cycle in the >>directory structure. > > > It looks like you have committed both patches to CVS. > > And I think both were indeed necessary.Yeah, I committed it after the loop in my .fonts prevented me from logging in... pat