Anthony Fok
2005-Nov-21  08:50 UTC
[Fontconfig] fontconfig or Xft bug? Segmentation fault with dangling symlink
Hello Keith,
While doing some testing with Firefly''s fix for mixed AA and non-AA
patch (which I think you fixed already, but not yet in XFree86 4.3.0
etc. and thus not yet propagated to most distributions), I tried to
reproduce the problem on Debian (unstable/sid), and move the Arial and
Verdana TrueType fonts out of the way so I could have only the bitmap
helvetica left.  After that, "xfd -fa arial-24" segfaults.  It is
likely triggered by a dangling symlink.
    In /etc/fonts/fonts.conf:
	<dir>/usr/share/fonts</dir>
	<dir>/var/lib/defoma/x-ttcidfont-conf.d/dirs</dir>
    /usr/share/fonts/truetype/Arial.ttf: 
	Actual font file
    /var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/Arial.ttf:
	Symlink to /usr/share/fonts/truetype/Arial.ttf
	(Yes, that''s the design of defoma Debian Font Manager.)
    Not sure if it matters: I don''t have
    /usr/share/fonts/truetype/fonts.cache-1
Steps to reproduce:
  1. Just to make sure everything is in a clean state, I removed
     ~/.fonts.cache-1.
  2. "xfd -fa arial-24" works fine.
  3. Move /usr/share/fonts/truetype/Arial.ttf out of the way.
  4. "xfd -fa arial-24" now shows error:
	Warning: Cannot convert string "arial-24" to type XftFont
	Segmentation fault
At this point, ~/.fonts.cache-1 was automatically updated with the
"/usr/share/fonts/truetype/Arial.ttf" entry removed, but the entry for
"/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/Arial.ttf" still
lingers, which is okay, I suppose.  :-)
XftFontClose() is called twice though: (I installed your latest
render-0.8, xrender-0.8.2 and xft-2.1.2 in /tmp/dest)
$ LD_LIBRARY_PATH=/tmp/dest/usr/X11R6/lib gdb --args ~/xfd -fa arial-24
...
(gdb) bt
#0  0x0804a8c5 in XftFontClose () at xftfreetype.c:995
#1  0x401a57b0 in vendorShellWidgetClass () from /usr/X11R6/lib/libXt.so.6
#2  0x40170301 in XtInitializeWidgetClass () from /usr/X11R6/lib/libXt.so.6
#3  0x401707ef in XtInitializeWidgetClass () from /usr/X11R6/lib/libXt.so.6
#4  0x40170c10 in _XtCreateWidget () from /usr/X11R6/lib/libXt.so.6
#5  0x40170e83 in XtCreateManagedWidget () from /usr/X11R6/lib/libXt.so.6
#6  0x08049822 in XftFontClose () at xftfreetype.c:995
#7  0x402b0a51 in __libc_start_main () from /lib/libc.so.6
The xftfreetype.c here is from xft-2.1.2.
Thanks in advance!
Cheers,
Anthony
P.S. I know I probably should use bugzilla, but I''m too sleepy now, and
     I''ll probably forget to report it if I don''t do it now,
so... :-)
-- 
Anthony Fok Tung-Ling
ThizLinux Laboratory   <anthony@thizlinux.com> http://www.thizlinux.com/
Debian Chinese Project <foka@debian.org>      
http://www.debian.org/intl/zh/
Come visit Our Lady of Victory Camp!           http://www.olvc.ab.ca/