The fontconfig library does not handle being told to include a directory correctly - instead of opening the directory and parsing the files within that directory, it opens the directory AS A FILE, then gets confused by the "." and ".." entries. The default /etc/fonts/fonts.conf contains the following: <tt> <!-- Load local system customization file --> <include ignore_missing="yes">conf.d</include> <include ignore_missing="yes">local.conf</include> </tt> And that "conf.d" won't work as is. I've tried putting a trailing "/*" on it, but that does not work either. An strace of an app using this shows the behavior: <tt> 2253 access("/etc/fonts/conf.d", R_OK) = 0 2253 open("/etc/fonts/conf.d", O_RDONLY) = 18 2253 fstat64(18, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 2253 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f54000 2253 read(18, 0x819e628, 8192) = -1 EISDIR (Is a directory) 2253 write(2, "Fontconfig error: \"conf.d\", line"..., 36) = 36 2253 write(2, "no element found", 16) = 16 2253 write(2, "\n", 1) = 1 2253 close(18) = 0 </tt> Ideally, the code should detect that the entity named is a directory, and open the files within and process them. System is a Fedora Core system with fontconfig-2.3.2-1 installed.
Modifying the fonts.conf file to directly include the files within conf.d causes the following errors on program load: Fontconfig warning: "conf.d/40-blacklist-fonts.conf", line 7: unknown element "selectfont" Fontconfig warning: "conf.d/40-blacklist-fonts.conf", line 8: unknown element "rejectfont" Fontconfig warning: "conf.d/40-blacklist-fonts.conf", line 9: unknown element "rejectfont" Fontconfig warning: "conf.d/40-blacklist-fonts.conf", line 10: unknown element "rejectfont" Fontconfig warning: "conf.d/40-blacklist-fonts.conf", line 11: unknown element "rejectfont" Fontconfig warning: "conf.d/40-blacklist-fonts.conf", line 12: unknown element "rejectfont" Fontconfig warning: "conf.d/40-blacklist-fonts.conf", line 13: unknown element "rejectfont" Fontconfig warning: "conf.d/40-blacklist-fonts.conf", line 14: unknown element "rejectfont" Fontconfig warning: "conf.d/40-blacklist-fonts.conf", line 15: unknown element "rejectfont" Fontconfig warning: "conf.d/40-blacklist-fonts.conf", line 16: unknown element "rejectfont" Fontconfig warning: "conf.d/40-blacklist-fonts.conf", line 17: unknown element "rejectfont" Fontconfig warning: "conf.d/40-blacklist-fonts.conf", line 18: unknown element "rejectfont" Fontconfig warning: "conf.d/no-bitmaps.conf", line 6: unknown element "selectfont" Fontconfig warning: "conf.d/no-bitmaps.conf", line 7: unknown element "rejectfont" Fontconfig warning: "conf.d/no-bitmaps.conf", line 8: unknown element "pattern" Fontconfig warning: "conf.d/no-bitmaps.conf", line 9: unknown element "patelt" Fontconfig warning: "conf.d/yes-bitmaps.conf", line 6: unknown element "selectfont" Fontconfig warning: "conf.d/yes-bitmaps.conf", line 7: unknown element "acceptfont" Fontconfig warning: "conf.d/yes-bitmaps.conf", line 8: unknown element "pattern"Fontconfig warning: "conf.d/yes-bitmaps.conf", line 9: unknown element "patelt"
There should have been a stat(2) syscall before the call to open. If there isn't, I suspect you've got an older version of fontconfig than you thought. 'fc-match --version' will show the version of fc-match you have (but not of the underlying library, alas). An 'ldd `which fc-match`' will check to see if you have a rogue library installed somewhere in your path.
fc-match --version fontconfig version 2.3.2 ldd /usr/bin/fc-match linux-gate.so.1 => (0xffffe000) libfontconfig.so.1 => /usr/X11R6/lib/libfontconfig.so.1 (0x44746000) libc.so.6 => /lib/libc.so.6 (0x4cb44000) libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x445e5000) libexpat.so.0 => /usr/X11R6/lib/libexpat.so.0 (0x4cf2b000) /lib/ld-linux.so.2 (0x4cb27000) libz.so.1 => /usr/lib/libz.so.1 (0x4cd99000) ls /usr/X11R6/lib/libfontconf* -l -rw-r--r-- 1 root root 178334 Mar 6 2003 /usr/X11R6/lib/libfontconfig.a lrwxrwxrwx 1 root root 22 Feb 17 2005 /usr/X11R6/lib/libfontconfig.so -> libfontconfig.so.1.0.4 lrwxrwxrwx 1 root root 22 Feb 17 2005 /usr/X11R6/lib/libfontconfig.so.1 -> libfontconfig.so.1.0.4 -rwxr-xr-x 1 root root 164441 Feb 17 2005 /usr/X11R6/lib/libfontconffig.so.1.0.4 I'll check my install of X later. However, I've seen other people having the same error on font config via Google searches, so I wanted to get an authorative report made.
Given that fc-match was found in /usr/bin and libfontconfig.so.1 was found in /usr/X11R6/lib, I wonder if you also have a libfontconfig.so.1 in /usr/lib and if the one in /usr/X11R6/lib came from some old X.org or XFree86 install. The 'normal' fontconfig build and install process will never place fontconfig in /usr/X11R6/lib, only an X.org or XFree86 build will.
You are correct - although the weird thing is that both the copy in /usr/X11/lib and in /usr/lib were 1.0.4.so However, removing the lib in X11 cured the problem - and the stat on conf.d does happen. So - NOTABUG. However, hopefully this may help other people who are seeing the same problem resolve it.
the real bug here is that fontconfig 2.3.2 uses the same .so version as older versions; it would have been nice to bump the revision field... Thanks for playing.
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.