[Fontconfig] Did fontconfig cause these Emacs segfaults?

Stephen Berman Stephen.Berman at gmx.net
Fri Dec 15 06:25:47 PST 2006


I'm currently running SUSE 10.1 and on this system I build CVS Emacs
with GTK support.  Emacs was running fine until I installed the SUSE
10.1 rpm of wxGTK, then the next time I started Emacs it immediately
segfaulted (no other GTK application segfaulted).  The backtrace
showed it crashing in libfontconfig; this is fontconfig-2.3.94-18.4.
Here are the first 11 frames of the backtrace:

Program received signal SIGSEGV, Segmentation fault.
0xb74b88fa in strcmp () from /lib/libc.so.6
(gdb) bt
#0  0xb74b88fa in strcmp () from /lib/libc.so.6
#1  0xb79c1b45 in FcObjectToPtr () from /usr/lib/libfontconfig.so.1
#2  0xb79c5741 in FcPatternAddWithBinding () from /usr/lib/libfontconfig.so.1
#3  0xb79c5df8 in FcPatternAdd () from /usr/lib/libfontconfig.so.1
#4  0xb79c5e84 in FcPatternBuild () from /usr/lib/libfontconfig.so.1
#5  0xb74150b8 in pango_fc_font_map_get_type ()
   from /opt/gnome/lib/libpangoft2-1.0.so.0
#6  0xb7af0830 in pango_font_map_load_fontset ()
   from /opt/gnome/lib/libpango-1.0.so.0
#7  0xb7aee84a in pango_context_get_font_description ()
   from /opt/gnome/lib/libpango-1.0.so.0
#8  0xb7aeeb92 in pango_itemize_with_base_dir ()
   from /opt/gnome/lib/libpango-1.0.so.0
#9  0xb7af6b0b in pango_layout_iter_get_char_extents ()
   from /opt/gnome/lib/libpango-1.0.so.0
#10 0xb7af76dc in pango_layout_iter_get_char_extents ()
   from /opt/gnome/lib/libpango-1.0.so.0
#11 0xb7cefedd in gtk_label_new () from /opt/gnome/lib/libgtk-x11-2.0.so.0

I had exchanges about this with the Emacs-GTK developer and with
wxwidget developers, and also posted to the openSUSE mailing list, but
didn't get a solution.

Since the installed libfontconfig.so was stripped, I installed the
source rpm from SUSE 10.1, and compiled it with debugging enabled.  In
the mean time I removed wxGTK and rebuilt the fontconfig cache several
times, and Emacs didn't segfault every time any more.  The last time
it sefaulted I got the following backtrace (first 15 frames):

Program received signal SIGSEGV, Segmentation fault.
0xb79c3e24 in FcPatternPosition (p=0xb68f9004, object=<value optimized out>)
    at fcint.h:828
828         return a - b;
(gdb) bt full
#0  0xb79c3e24 in FcPatternPosition (p=0xb68f9004,
    object=<value optimized out>) at fcint.h:828
        low = 0
        high = 17
        mid = 8
        c = <value optimized out>
        obj = 21
#1  0xb79c3e87 in FcPatternFindElt (p=0xb68f9004, object=0xb79d7491 "file")
    at fcpat.c:725
        i = -1219047104
#2  0xb79c5536 in FcPatternGet (p=0xb68f9004, object=0xb79d7491 "file", id=0,
    v=0xbffe1330) at fcpat.c:1107
        e = <value optimized out>
        l = <value optimized out>
#3  0xb79c58ba in FcPatternGetString (p=0xb68f9004, object=0xb79d7491 "file",
    id=0, s=0xbffe1398) at fcpat.c:1172
        v = {
  type = 140255896,
  u = {
    s = 0x85e92a8 "/usr/X11R6/lib/X11/fonts/misc/cu12.pcf.gz",
    s_off = 140415656,
    i = 140415656,
    b = 140415656,
    d = -1.8797073676043201,
    m = 0x85e92a8,
    c = 0x85e92a8,
    c_off = 140415656,
    f = 0x85e92a8,
    p = 0x85e92a8,
    l = 0x85e92a8,
    l_off = 140415656
  }
}
        r = <value optimized out>
#4  0xb79b35da in FcConfigBuildFonts (config=0x85c2298) at fccfg.c:314
        cfn = (FcChar8 *) 0x85e92a8 "/usr/X11R6/lib/X11/fonts/misc/cu12.pcf.gz"
        fonts = (FcFontSet *) 0x85c5f38
        cached_fonts = (FcFontSet *) 0x85cd988
        cache = (FcGlobalCache *) 0x85c5ee0
        list = <value optimized out>
        oldDirs = (FcStrSet *) 0x85c7e30
        dir = <value optimized out>
#5  0xb79bbf7f in FcInitLoadConfigAndFonts () at fcinit.c:85
        config = (FcConfig *) 0x85c2298
#6  0xb79bc085 in FcInit () at fcinit.c:103
        config = <value optimized out>
#7  0xb6a94d0b in XftInit () from /usr/X11R6/lib/libXft.so.2
No symbol table info available.
#8  0xb6d5a39a in qt_init_internal () from /usr/lib/qt3/lib/libqt-mt.so.3
No symbol table info available.
#9  0xb6d5b08b in qt_init () from /usr/lib/qt3/lib/libqt-mt.so.3
No symbol table info available.
#10 0xb6dc1ee3 in QApplication::QApplication ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
No symbol table info available.
#11 0xb72d2155 in createQApp ()
   from /opt/gnome/lib/gtk-2.0/2.4.0/engines/libqtengine.so
No symbol table info available.
#12 0xb72c4e3f in theme_init ()
   from /opt/gnome/lib/gtk-2.0/2.4.0/engines/libqtengine.so
No symbol table info available.
#13 0xb7da0a66 in gtk_theme_engine_get ()
   from /opt/gnome/lib/libgtk-x11-2.0.so.0
No symbol table info available.
#14 0xb7a7aeb8 in g_type_module_use () from /opt/gnome/lib/libgobject-2.0.so.0
No symbol table info available.
#15 0xb7da0899 in gtk_theme_engine_get ()
   from /opt/gnome/lib/libgtk-x11-2.0.so.0
No symbol table info available.

The Emacs-GTK developer didn't know why this segfault happened but
suggested that /usr/X11R6/lib/X11/fonts/misc/cu12.pcf.gz might be
broken and also speculated that the reason only Emacs among GTK apps
segfaulted was that Emacs lacks antialiasing fonts.

If anyone here has any insight from these backtraces, I would be
interested to hear it, even though Emacs hasn't segfaulted for several
days now.  I will soon be upgrading to SUSE 10.2, so that may take
care of this problem, but I wanted to make a last effort to find out
why it happened.

Thanks,
Steve Berman



More information about the Fontconfig mailing list