Hi all, while testing fontconfig 2.3.93, I found a bug in fc-cat : if you run : fc-cat ~/.font.cache-2 (you need to have such a file), you will get incorrect output : fc-cat: printing directory cache contents for dir <random junk here> then : fc-cat: printing global cache contents for dir /usr/X11R6/lib/X11/fonts/100dpi "/home/a/UTFBI__10-ISO8859-1.pcf.gz" .... the basename of the cache file is printed to generate font path instead of the font directory. -- Frederic Crozat <fcrozat@mandriva.com> Mandriva
Frederic Crozat <fcrozat@mandriva.com> ????????:> Hi all, > > while testing fontconfig 2.3.93, I found a bug in fc-cat : > > if you run : > fc-cat ~/.font.cache-2 (you need to have such a file), you will get > incorrect output : > > fc-cat: printing directory cache contents for dir <random junk here> > > then : > fc-cat: printing global cache contents for > dir /usr/X11R6/lib/X11/fonts/100dpi > "/home/a/UTFBI__10-ISO8859-1.pcf.gz" .... > > the basename of the cache file is printed to generate font path instead > of the font directory.Yes, I can reproduce that. When I call "fc-cat .fonts.cache-2" while ~ is the current directory fc-cat: printing directory cache contents for dir 23fb17 78563412 1 8 4 20 10 8 18 4 10 10 4 8 20 8 8 2 20 4 30 1000 fc-cat: printing global cache contents for dir /usr/X11R6/lib/X11/fonts/truetype "./SUETTER.TTF" ... And when I call it as "fc-cat ~/.fonts.cache-2" (current directory doesn''t matter): fc-cat: printing directory cache contents for dir 23fb17 78563412 1 8 4 20 10 8 18 4 10 10 4 8 20 8 8 2 20 4 30 1000 fc-cat: printing global cache contents for dir /usr/X11R6/lib/X11/fonts/truetype "/home/mfabian/SUETTER.TTF" ... -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ?????????????
Frederic Crozat wrote:> Hi all, > > while testing fontconfig 2.3.93, I found a bug in fc-cat : > > if you run : > fc-cat ~/.font.cache-2 (you need to have such a file), you will get > incorrect output :I''ve just committed a patch for this bug (and another issue I found while testing this patch). Please let me know if it works. It changes the format of the ~/.fonts.cache-2 file in a minor (but incompatible) way. pat
Patrick Lam <plam@MIT.EDU> ????????:> Frederic Crozat wrote: >> Hi all, >> >> while testing fontconfig 2.3.93, I found a bug in fc-cat : >> >> if you run : >> fc-cat ~/.font.cache-2 (you need to have such a file), you will get >> incorrect output : > > I''ve just committed a patch for this bug (and another issue I found > while testing this patch). Please let me know if it works. It changes > the format of the ~/.fonts.cache-2 file in a minor (but incompatible) way.It behaves strange for me now: mfabian@magellan:~$ rm -f .fonts.cache-2 mfabian@magellan:~$ fc-match sans hgjgbbmp.ttc: "HGPGothicB" "Regular" mfabian@magellan:~$ ll .fonts.cache-2 -rw------- 1 mfabian suse 4927489 1? 5 17:39 .fonts.cache-2 mfabian@magellan:~$ fc-cat ~/.fonts.cache-2 fc-cat: printing global cache contents for dir /home/mfabian/.fonts/kde-override mfabian@magellan:~$ Allthough the generated file is quite big, fc-cat lists only one line now. This is on an AMD 64 bit machine: mfabian@magellan:~$ uname -a Linux magellan 2.6.15-rc6-git2-2-default #1 Thu Dec 22 14:15:42 UTC 2005 x86_64 x86_64 x86_64 GNU/Linux mfabian@magellan:~$ -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ?????????????
Mike FABIAN <mfabian@suse.de> ????????:> Patrick Lam <plam@MIT.EDU> ????????: > >> Frederic Crozat wrote: >>> Hi all, >>> >>> while testing fontconfig 2.3.93, I found a bug in fc-cat : >>> >>> if you run : >>> fc-cat ~/.font.cache-2 (you need to have such a file), you will get >>> incorrect output : >> >> I''ve just committed a patch for this bug (and another issue I found >> while testing this patch). Please let me know if it works. It changes >> the format of the ~/.fonts.cache-2 file in a minor (but incompatible) way. > > It behaves strange for me now: > > mfabian@magellan:~$ rm -f .fonts.cache-2 > mfabian@magellan:~$ fc-match sans > hgjgbbmp.ttc: "HGPGothicB" "Regular" > mfabian@magellan:~$ ll .fonts.cache-2 > -rw------- 1 mfabian suse 4927489 1? 5 17:39 .fonts.cache-2 > mfabian@magellan:~$ fc-cat ~/.fonts.cache-2 > fc-cat: printing global cache contents for dir /home/mfabian/.fonts/kde-override > mfabian@magellan:~$ > > Allthough the generated file is quite big, fc-cat lists only > one line now. > > This is on an AMD 64 bit machine: > > mfabian@magellan:~$ uname -a > Linux magellan 2.6.15-rc6-git2-2-default #1 Thu Dec 22 14:15:42 UTC 2005 x86_64 x86_64 x86_64 GNU/Linux > mfabian@magellan:~$It''s even worse then I reported above: mfabian@magellan:~$ xfd -fa "Nimbus Sans L" mfabian@magellan:~$ works. mfabian@magellan:~$ fc-match "Nimbus Sans L" n019003l.pfb: "Nimbus Sans L" "Regular" mfabian@magellan:~$ works. Now delete all global caches: mfabian@magellan:~$ sudo rm /var/cache/fontconfig/* mfabian@magellan:~$ call fc-match again: mfabian@magellan:~$ fc-match "Nimbus Sans L" n019003l.pfb: "Nimbus Sans L" "Regular" mfabian@magellan:~$ .fonts.cache-2 has been created but it is weird: mfabian@magellan:~$ fc-cat .fonts.cache-2 fc-cat: printing global cache contents for dir /home/mfabian/.fonts/kde-override mfabian@magellan:~$ and "xfd -fa" crashes now for all fonts: mfabian@magellan:~$ xfd -fa "Nimbus Sans L" Warning: Cannot convert string "Nimbus Sans L" to type XftFont ????????????? (core dumped) mfabian@magellan:~$ -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ?????????????
Mike FABIAN wrote:>>Allthough the generated file is quite big, fc-cat lists only >>one line now.I think I''ve fixed this set of bugs now. They were related. pat
Patrick Lam <plam@MIT.EDU> ????????:> Mike FABIAN wrote: >>>Allthough the generated file is quite big, fc-cat lists only >>>one line now. > > I think I''ve fixed this set of bugs now. They were related.Thank you, with todays CVS fccat starts printing the contents of ~/.fonts.cache correctly now, but it crashes before finishing: mfabian@magellan:~$ fc-cat ~/.fonts.cache-2 [...] fc-cat: printing global cache contents for dir /usr/X11R6/lib/X11/fonts/CID/Adobe-CNS1/CIDFont "MOEKai-Regular" 0 "MOE Kai:style=Regular:slant=0:weight=80:width=100:spacing=100:foundry=unknown:index=0:outline=True:scalable=True:charset=:lang=:fontversion=0:fontformat=CID Type 1" "MOESung-Regular" 0 "MOE Sung:style=Regular:slant=0:weight=80:width=100:spacing=100:foundry=unknown:index=0:outline=True:scalable=True:charset=:lang=:fontversion=0:fontformat=CID Type 1" fc-cat: printing global cache contents for dir /usr/X11R6/lib/X11/fonts/CID/Adobe-CNS1/CFM fc-cat: printing global cache contents for dir /usr/X11R6/lib/X11/fonts/CID/Adobe-CNS1/AFM fc-cat: printing global cache contents for dir /usr/X11R6/lib/X11/fonts/CID/Adobe-CNS1 *** glibc detected *** fc-cat: free(): invalid next size (fast): 0x0000000000509180 *** ======= Backtrace: ======== /lib64/libc.so.6[0x2aaaab123eed] /lib64/libc.so.6(__libc_free+0x6c)[0x2aaaab12550c] fc-cat[0x405427] /lib64/libc.so.6(__libc_start_main+0xf4)[0x2aaaab0d6fc4] fc-cat[0x402389] [...] Aborted (core dumped) mfabian@magellan:~$ And "xfd -fa" still crashes for all fonts afterwards: mfabian@magellan:~$ xfd -fa "sans" Warning: Cannot convert string "sans" to type XftFont Segmentation fault (core dumped) mfabian@magellan:~$ (I deleted all global caches in /var/cache/fontconfig for testing, then created ~/.fonts.cache-2 from scratch by deleting it and then calling "fc-match sans". -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ?????????????
Mike FABIAN <mfabian@suse.de> ????????:> Thank you, with todays CVS fccat starts printing the contents of > ~/.fonts.cache correctly now, but it crashes before finishing: > > mfabian@magellan:~$ fc-cat ~/.fonts.cache-2[...]> Aborted (core dumped) > mfabian@magellan:~$I can fix that crash by the attached patch.> And "xfd -fa" still crashes for all fonts afterwards:This crash still remains. -------------- next part -------------- A non-text attachment was scrubbed... Name: fc-cat-crash.patch Type: text/x-patch Size: 783 bytes Desc: not available Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20060109/cbc9e446/fc-cat-crash.bin -------------- next part -------------- -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ?????????????
Mike FABIAN <mfabian@suse.de> ????????:>> And "xfd -fa" still crashes for all fonts afterwards: > > This crash still remains.Most likely because the file name reported by "fc-list" and "fc-match" is wrong now: mfabian@magellan:~/c$ fc-list "Albany AMT" family file /usr/X11R6/lib/X11/fonts/albw.ttf: Albany AMT /usr/X11R6/lib/X11/fonts/albwbi.ttf: Albany AMT /usr/X11R6/lib/X11/fonts/albwb.ttf: Albany AMT /usr/X11R6/lib/X11/fonts/albwi.ttf: Albany AMT mfabian@magellan:~/c$ fc-match -v "Albany AMT" Pattern has 28 elts (size 32) family: "Albany AMT"(s) [...] file: "/usr/X11R6/lib/X11/fonts/albw.ttf"(s) [...] embeddedbitmap: FcFalse(w) mfabian@magellan:~/c$ But the font isn''t there: mfabian@magellan:~/c$ ll /usr/X11R6/lib/X11/fonts/albw.ttf ls: /usr/X11R6/lib/X11/fonts/albw.ttf: ?????????????????????? mfabian@magellan:~/c$ It is here: mfabian@magellan:~/c$ ll /usr/X11R6/lib/X11/fonts/truetype/albw.ttf -rw-r--r-- 1 root root 169056 12? 27 09:48 /usr/X11R6/lib/X11/fonts/truetype/albw.ttf mfabian@magellan:~/c$ The last subdirectory is missing. -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ?????????????
Mike FABIAN <mfabian@suse.de> ????????:> Mike FABIAN <mfabian@suse.de> ????????: > >>> And "xfd -fa" still crashes for all fonts afterwards: >> >> This crash still remains. > > Most likely because the file name reported by "fc-list" and > "fc-match" is wrong now:[... last directory element was always missing in the full path name ...] The problem was still there after I updated from CVS today, the last ChangeLog entry is: 2006-01-10 Patrick Lam <plam@mit.edu> * src/fccache.c (FcDirCacheConsume, FcDirCacheOpen, FcDirCacheValid, FcDirCacheHasCurrentArch, FcDirCacheUnlink, FcDirCacheRead, FcDirCacheConsume): * fc-cache/fc-cache.c (main): Explicitly add font dirs to config.fontDirs even if they''re empty. Set current config in fc-cache.c. Fix treatment of cache directory as read from cache file; don''t use string equality to determine if we have the right file, use inode equality. But this doesn''t seem to have fixed it either. I made a small one line patch (attached) which seems to fix the problem for me. Is this patch correct? -------------- next part -------------- A non-text attachment was scrubbed... Name: full-path-problem.patch Type: text/x-patch Size: 586 bytes Desc: not available Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20060111/1334436b/full-path-problem.bin -------------- next part -------------- -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ?????????????
Le mercredi 11 janvier 2006 ? 15:36 +0100, Mike FABIAN a ?crit :> Mike FABIAN <mfabian@suse.de> ????????: > > > Mike FABIAN <mfabian@suse.de> ????????: > > > >>> And "xfd -fa" still crashes for all fonts afterwards: > >> > >> This crash still remains. > > > > Most likely because the file name reported by "fc-list" and > > "fc-match" is wrong now: > > [... last directory element was always missing in the full path name ...] > > The problem was still there after I updated from CVS today, > the last ChangeLog entry is: > > 2006-01-10 Patrick Lam <plam@mit.edu> > * src/fccache.c (FcDirCacheConsume, FcDirCacheOpen, > FcDirCacheValid, FcDirCacheHasCurrentArch, > FcDirCacheUnlink, FcDirCacheRead, FcDirCacheConsume): > * fc-cache/fc-cache.c (main): > > Explicitly add font dirs to config.fontDirs even if they''re empty. > Set current config in fc-cache.c. > Fix treatment of cache directory as read from cache file; don''t > use string equality to determine if we have the right file, > use inode equality. > > But this doesn''t seem to have fixed it either. > > I made a small one line patch (attached) which seems to fix the > problem for me. Is this patch correct?I can confirm this patch fixes crashes people have reported on cooker mailing list with the latest CVS snapshot I uploaded yesterday. fontconfig was returning wrong path info to application (for instance, /usr/X11R6/lib/X11/fonts/Vera.ttf instead of /usr/X11R6/lib/X11/fonts/TTF/Vera.ttf ), causing pango based applications to crash : pango / cairo don''t deal really well when they get a path from fontconfig to a inexistant file, then they ask fontconfign for information about this file and fontconfig crashes.. -- Frederic Crozat <fcrozat@mandriva.com> Mandriva
Mike FABIAN wrote:> I made a small one line patch (attached) which seems to fix the > problem for me. Is this patch correct?I don''t think it is, but I think I committed a correct patch which applies FcConfigNormalizeFontDir consistently now. pat
Le samedi 14 janvier 2006 ? 13:30 -0800, Patrick Lam a ?crit :> Mike FABIAN wrote: > > I made a small one line patch (attached) which seems to fix the > > problem for me. Is this patch correct? > > I don''t think it is, but I think I committed a correct patch which > applies FcConfigNormalizeFontDir consistently now.Well, it is still incorrect. Try the following : rm -rf /var/cache/fontconfig as simple user, run "xterm -fa sans" => cache is created as ~/.fonts.cache-2 and everything is fine re-run xterm -fa sans => xterm fallbacks to xfs using FC_DEBUG=1, you can see file information sent to applications for fonts are incorrect. For instance : /usr/share/fonts/DejaVuSans.ttf instead of /usr/share/fonts/ttf/dejavu/DejaVuSans.ttf Moreover, both fc-cache . and fc-cache /foo/bar vs fc-cache /foo/bar/ bugs are back. -- Frederic Crozat <fcrozat@mandriva.com> Mandriva
Frederic Crozat <fcrozat@mandriva.com> ????????:>> I made a small one line patch (attached) which seems to fix the >> problem for me. Is this patch correct? > > I can confirm this patch fixes crashes people have reported on cooker > mailing list with the latest CVS snapshot I uploaded yesterday. > > fontconfig was returning wrong path info to application (for > instance, /usr/X11R6/lib/X11/fonts/Vera.ttf instead > of /usr/X11R6/lib/X11/fonts/TTF/Vera.ttf ), causing pango based > applications to crash : pango / cairo don''t deal really well when they > get a path from fontconfig to a inexistant file, then they ask > fontconfign for information about this file and fontconfig crashes..The same problem occurs with all KDE applications and even with simple applications like "xfd -fa". -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ?????????????
Frederic Crozat <fcrozat@mandriva.com> ????????:> Le samedi 14 janvier 2006 ? 13:30 -0800, Patrick Lam a ?crit : >> Mike FABIAN wrote: >> > I made a small one line patch (attached) which seems to fix the >> > problem for me. Is this patch correct? >> >> I don''t think it is, but I think I committed a correct patch which >> applies FcConfigNormalizeFontDir consistently now. > > Well, it is still incorrect. > > Try the following : > rm -rf /var/cache/fontconfig > as simple user, run "xterm -fa sans" => cache is created as > ~/.fonts.cache-2 and everything is fine > re-run xterm -fa sans => xterm fallbacks to xfs > > using FC_DEBUG=1, you can see file information sent to applications for > fonts are incorrect. For instance : > /usr/share/fonts/DejaVuSans.ttf instead > of /usr/share/fonts/ttf/dejavu/DejaVuSans.ttfYes, I can confirm that it is still incorrect like Frederic writes. What was wrong with my attached patch? I''m not sure but I think something similar is necessary. if (!FcDirCacheConsume (cache->fd, dir, set, config)) always adds the top-level directory to the list of directories which is then used in FcConfigNormalizeFontDir(). For example it adds the same directory /usr/X11R6/lib/X11/fonts/ many times but never the subdirectories like /usr/X11R6/lib/X11/fonts/Type1/ ... Replacing "dir" by "d->name" like if (!FcDirCacheConsume (cache->fd, d->name, set, config)) seems to fix this because now the correct directory names area added to the list. -------------- next part -------------- A non-text attachment was scrubbed... Name: full-path-problem.patch Type: text/x-patch Size: 586 bytes Desc: not available Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20060117/94eab4b4/full-path-problem.bin -------------- next part -------------- -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ?????????????
Frederic Crozat <fcrozat@mandriva.com> ????????:> Moreover, both fc-cache . and fc-cache /foo/bar vs fc-cache /foo/bar/ > bugs are back.I still need to apply my patch from http://lists.freedesktop.org/archives/fontconfig/2006-January/001890.html Without that patch, the issue Frederic describes is still there. -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ?????????????
Mike FABIAN wrote:> Yes, I can confirm that it is still incorrect like Frederic writes. > > What was wrong with my attached patch? I''m not sure > but I think something similar is necessary. > > if (!FcDirCacheConsume (cache->fd, dir, set, config)) > > always adds the top-level directory to the list of directories > which is then used in FcConfigNormalizeFontDir(). For example it adds > the same directory /usr/X11R6/lib/X11/fonts/ many times but never > the subdirectories like /usr/X11R6/lib/X11/fonts/Type1/ ... > Replacing "dir" by "d->name" like > > if (!FcDirCacheConsume (cache->fd, d->name, set, config)) > > seems to fix this because now the correct directory names area added > to the list.I don''t think it should be necessary if you don''t normalize the path in the outer fc-cat loop, because you have to treat the directory anyway before you can emit the cache, which should cause the proper directory to be added to fontDirs. Clearly the present code is incorrect, and I''ll look at it (since I''m now back in civilization), but I think that we can avoid the issues involved with your patch. Also, if d->name and dir don''t match, there''s something wrong... pat
Patrick Lam <plam@MIT.EDU> ????????:> Mike FABIAN wrote: >> Yes, I can confirm that it is still incorrect like Frederic writes. >> What was wrong with my attached patch? I''m not sure >> but I think something similar is necessary. if >> (!FcDirCacheConsume (cache->fd, dir, set, config)) >> always adds the top-level directory to the list of directories >> which is then used in FcConfigNormalizeFontDir(). For example it adds >> the same directory /usr/X11R6/lib/X11/fonts/ many times but never >> the subdirectories like /usr/X11R6/lib/X11/fonts/Type1/ ... >> Replacing "dir" by "d->name" like >> if (!FcDirCacheConsume (cache->fd, d->name, set, config)) >> seems to fix this because now the correct directory names area added >> to the list. > > I don''t think it should be necessary if you don''t normalize the path > in the outer fc-cat loop, because you have to treat the directory > anyway before you can emit the cache, which should cause the proper > directory to be added to fontDirs. Clearly the present code is > incorrect, and I''ll look at it (since I''m now back in civilization), > but I think that we can avoid the issues involved with your patch. > > Also, if d->name and dir don''t match, there''s something wrong...Then why is the comparison done like this in FcGlobalCacheReadDir(): if (strncmp (d->name, dir, strlen(dir)) == 0) ? That checks whether "d->name" is a subdirectory of "dir". If "d->name" and "dir" have to match here, the comparison should be if (strcmp (d->name, dir) == 0) But then it would almost always fail, except for the top-level directory. Can''t you reproduce the following problem?: First delete all caches: root@magellan:~# pwd /root root@magellan:~# rm -f .fonts.cache-2 root@magellan:~# rm -f /var/cache/fontconfig/*cache* root@magellan:~# Now call fc-match which generates the user specific cache /root/.fonts.cache-2: root@magellan:~# fc-match -v "Luxi Mono" Pattern has 29 elts (size 32) family: "Luxi Mono"(s) familylang: "en"(s) style: "Regular"(s) stylelang: "en"(s) slant: 0(i)(s) weight: 80(i)(s) width: 100(i)(s) size: 12(f)(s) pixelsize: 12.5(f)(s) spacing: 100(i)(s) foundry: "b&h"(s) antialias: FcTrue(w) hintstyle: 3(i)(s) hinting: FcTrue(s) verticallayout: FcFalse(s) autohint: FcTrue(w) globaladvance: FcTrue(s) file: "/usr/X11R6/lib/X11/fonts/truetype/luximr.ttf"(s) index: 0(i)(s) outline: FcTrue(s) scalable: FcTrue(s) dpi: 75(f)(s) rgba: 0(i)(w) scale: 1(f)(s) charset: set(s) lang: aa|af|ast|ay|bi|br|ca|ch|co|cs|da|et|eu|fj|fo|fr|fur|fy|gd|gl|gv|ho|hu|ia|id|ie|io|is|kl|lb|mg|mt|nb|nds|nn|no|oc|om|pl|rm|se|sk|sma|smj|smn|so|sq|sv|sw|tn|tr|ts|vo|wa|wen|wo|xh|yap|zu(s) fontversion: 78643(i)(s) fontformat: "TrueType"(s) embeddedbitmap: FcFalse(w) root@magellan:~# Note that the full path to the font file listed here is correct! But now call the fc-match once again with the same arguments: root@magellan:~# fc-match -v "Luxi Mono" Pattern has 29 elts (size 32) family: "Luxi Mono"(s) familylang: "en"(s) style: "Regular"(s) stylelang: "en"(s) slant: 0(i)(s) weight: 80(i)(s) width: 100(i)(s) size: 12(f)(s) pixelsize: 12.5(f)(s) spacing: 100(i)(s) foundry: "b&h"(s) antialias: FcTrue(w) hintstyle: 3(i)(s) hinting: FcTrue(s) verticallayout: FcFalse(s) autohint: FcTrue(w) globaladvance: FcTrue(s) file: "/usr/X11R6/lib/X11/fonts/luximr.ttf"(s) index: 0(i)(s) outline: FcTrue(s) scalable: FcTrue(s) dpi: 75(f)(s) rgba: 0(i)(w) scale: 1(f)(s) charset: set(s) lang: aa|af|ast|ay|bi|br|ca|ch|co|cs|da|et|eu|fj|fo|fr|fur|fy|gd|gl|gv|ho|hu|ia|id|ie|io|is|kl|lb|mg|mt|nb|nds|nn|no|oc|om|pl|rm|se|sk|sma|smj|smn|so|sq|sv|sw|tn|tr|ts|vo|wa|wen|wo|xh|yap|zu(s) fontversion: 78643(i)(s) fontformat: "TrueType"(s) embeddedbitmap: FcFalse(w) root@magellan:~# The full path to the font file listed now is incorrect, it lacks the final subdirectory.>From now on it will stay like that and all applications usingfontconfig will crash. -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ?????????????
Mike FABIAN <mfabian@suse.de> ????????:> Patrick Lam <plam@MIT.EDU> ????????: > >> Mike FABIAN wrote: >>> Yes, I can confirm that it is still incorrect like Frederic writes. >>> What was wrong with my attached patch? I''m not sure >>> but I think something similar is necessary. if >>> (!FcDirCacheConsume (cache->fd, dir, set, config)) >>> always adds the top-level directory to the list of directories >>> which is then used in FcConfigNormalizeFontDir(). For example it adds >>> the same directory /usr/X11R6/lib/X11/fonts/ many times but never >>> the subdirectories like /usr/X11R6/lib/X11/fonts/Type1/ ... >>> Replacing "dir" by "d->name" like >>> if (!FcDirCacheConsume (cache->fd, d->name, set, config)) >>> seems to fix this because now the correct directory names area added >>> to the list. >> >> I don''t think it should be necessary if you don''t normalize the path >> in the outer fc-cat loop, because you have to treat the directory >> anyway before you can emit the cache, which should cause the proper >> directory to be added to fontDirs. Clearly the present code is >> incorrect, and I''ll look at it (since I''m now back in civilization), >> but I think that we can avoid the issues involved with your patch. >> >> Also, if d->name and dir don''t match, there''s something wrong... > > Then why is the comparison done like this in FcGlobalCacheReadDir(): > > if (strncmp (d->name, dir, strlen(dir)) == 0) > > ? > > That checks whether "d->name" is a subdirectory of "dir". > > If "d->name" and "dir" have to match here, the comparison > should be > > if (strcmp (d->name, dir) == 0) > > But then it would almost always fail, except for the top-level > directory. > > Can''t you reproduce the following problem?:[... procedure how to reproduce ...] When reading a user specific cache like $HOME/.fonts.cache-2, the cache may contain information for many font directories. For that reason the code in FcGlobalCacheReadDir() loops over all dirs found in "cache". for (d = cache->dirs; d; d = d->next) Therefore, the directory given within that loop as a parameter to the FcDirCacheConsume() call must be the directory from the current value of "d" in that loop, i.e. "d->name". Therefore I believe my patch is correct and I cannot find any issues with that patch. I just fixes the problem described in my last mail. -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ?????????????