[Fontconfig] Re: Crash when non-existing directories are referenced in ~/.fonts.cache

Ronny V. Vindenes ronnyvv at broadpark.no
Thu Jan 26 16:55:30 PST 2006


tor, 26,.01.2006 kl. 19.31 -0500, skrev Patrick Lam:
> Mike FABIAN wrote:
> > The following code in FcConfigNormalizeFontDir ()
> > 
> >      /* Ok, we didn't find it in fontDirs; let's add subdirs.... */
> >      for (n = 0; n < config->fontDirs->num; n++)
> >  	FcConfigAddFontDirSubdirs (config, config->fontDirs->strs[n]);
> > 
> > adds the same subdirectories many times because 
> > config->fontDirs->num is getting bigger during the for loop.
> > 
> > This causes many unnecessary opendir() and readdir() calls.
> > 
> > I think one should end the for loop when the initial value of
> > config->fontDirs->num is reached. All values in the list after the
> > initial value of num are newly added subdirectories, there is no
> > reason to scan them for subdirectories again.
> 
> I've committed my version of this patch and a fix for fc-cache.
> 
> In my experience, fc-cache . and fc-cache with a trailing slash work
> correctly now.  Let me know if there are any remaining issues.  I'll
> also try to test it more myself.
> 

Something broke badly in this commit - fc-match or any app using fc now
loops with "Fontconfig error: Cannot load default config file" untill
they segfault. Reverting to the previous commit things work fine (and
fc-cache no longer creates broken caches - yay!).

-- 
Ronny V. Vindenes <ronnyvv at broadpark.no>



More information about the Fontconfig mailing list