From an e-mail sent to xorg-ml a couple of days ago: The current catalogue:<dir> implementation on libXfont rescan the font paths only if <dir> (fontpath.d) has its mtime changed. The problem is that most of the time, what changes is not the fontpath.d dir, but the dirs pointed by the symlinks (e.g. some fonts are installed inside the same directory, package managers write the symlink before the directory is changed, user can run mkfontdir, etc). I'm not familiar enough with libXfont to implement an optimal solution, so I cooked a simple and non-intrusive patch that does the work by forcing a rescan in case any of the dirs have its mtime changed (below, applies on top of my previous libXfont patches). My solution is not optimal since it runs through the fontpath.d dir twice (once to check mtime and once to build the FPEs), but it works and accoding to my tests the performance cost is far from being noticeable. So, what do you think? Any chances of merging such a patch? (this patch applies on top of the one from bug #11572)
Created attachment 10702 [details] [review] rescan catalogue:<dir> fontpaths on directory changes (b0rken)
Comment on attachment 10702 [details] [review] rescan catalogue:<dir> fontpaths on directory changes (b0rken) this patch is broken, there's a duplicated closedir() call at the end. I'll attach a new one.
Created attachment 10717 [details] [review] rescan catalogue:<dir> fontpaths on directory changes
I'd like to keep the fontpath.d code simple and I don't think we should worry to much about the corner cases, since you can always just fall back and issue a xset fp rehash Also, for packaging, you can always just force the symlink, even though it's already there, which will bump the mtime on the fontpath.d dir. Sounds ok?
The only problem is that it's not intuitive to touch fontpath.d/ to force a rehash (restarting xfs was) and users got used to the non need of running xset fp rehash. When packaging, we're subject to a race (a package may, for example, add the symlink as the package payload (%files) and run mkfontdir in %post). Or users may add the symlink manually and run mkfontdir later, etc. But the current code is not elegant (I don't like the double loop) and I guess a more beautiful solution would add considerable complexity. Ultimately it's your call... That's why I submmited the patch as a RFC. :-)
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.