Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 703270 - app-editors/emacs-26.3-r1 crashes with USE=xft
Summary: app-editors/emacs-26.3-r1 crashes with USE=xft
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: GNU Emacs project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-18 08:16 UTC by Liu Yang
Modified: 2020-10-03 15:45 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
bt full output in gdb (eamcs-backtrace.txt,67.96 KB, text/plain)
2019-12-20 10:40 UTC, Liu Yang
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Liu Yang 2019-12-18 08:16:11 UTC
Latest Emacs will crash when I enable xft support in it's USE. I tried to remove xft and re-emerge it, it works fine, but it won't display well with many Chinese characters.
Comment 1 Liu Yang 2019-12-18 08:16:55 UTC
My USE with Emacs now is below:
$ emerge -qpv emacs
[ebuild   R   ] app-editors/emacs-26.3-r1  USE="X acl alsa dynamic-loading games gconf gfile gif gpm gsettings gtk gzip-el imagemagick inotify jpeg lcms libxml2 m17n-lib mailutils png sound ssl svg systemd threads tiff toolkit-scroll-bars wide-int xft xpm zlib -Xaw3d (-aqua) -athena (-cairo) -dbus -gtk2 -kerberos -livecd -motif (-selinux) -source -xwidgets"
Comment 2 Liu Yang 2019-12-18 08:17:43 UTC
$ emerge --info
Portage 2.3.79 (python 3.6.9-final-0, default/linux/amd64/17.0/desktop/gnome/systemd, gcc-9.2.0, glibc-2.29-r7, 5.4.3 x86_64)
=================================================================
System uname: Linux-5.4.3-x86_64-Intel-R-_Xeon-R-_CPU_E31230_@_3.20GHz-with-gentoo-2.6
KiB Mem:    16418120 total,  11063592 free
KiB Swap:   16776764 total,  16562492 free
Timestamp of repository gentoo: Wed, 18 Dec 2019 03:00:01 +0000
Head commit of repository gentoo: 441645d6e78fd4a0f2cc9d2f5196f1ba5c2f85da
sh bash 4.4_p23-r1
ld GNU ld (Gentoo 2.32 p2) 2.32.0
ccache version 3.7.4 [enabled]
app-shells/bash:          4.4_p23-r1::gentoo
dev-java/java-config:     2.2.0-r4::gentoo
dev-lang/perl:            5.30.1::gentoo
dev-lang/python:          2.7.17::gentoo, 3.6.9::gentoo
dev-util/ccache:          3.7.4::gentoo
dev-util/cmake:           3.14.6::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.11.6-r3::gentoo, 1.16.1-r1::gentoo
sys-devel/binutils:       2.32-r1::gentoo
sys-devel/gcc:            9.2.0-r2::gentoo
sys-devel/gcc-config:     2.1::gentoo
sys-devel/libtool:        2.4.6-r3::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 4.19::gentoo (virtual/os-headers)
sys-libs/glibc:           2.29-r7::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-max-age: 24
    sync-rsync-extra-opts: 
    sync-rsync-verify-jobs: 1

localmine
    location: /usr/local/portage
    masters: gentoo

docker
    location: /var/lib/layman/docker
    masters: gentoo
    priority: 50

emacs
    location: /var/lib/layman/emacs
    masters: gentoo
    priority: 50

gentoo-zh
    location: /var/lib/layman/gentoo-zh
    masters: gentoo
    priority: 50

gnome
    location: /var/lib/layman/gnome
    masters: gentoo
    priority: 50

go-overlay
    location: /var/lib/layman/go-overlay
    masters: gentoo
    priority: 50

lisp
    location: /var/lib/layman/lisp
    masters: gentoo
    priority: 50

multilib-portage
    location: /var/lib/layman/multilib-portage
    masters: gentoo
    priority: 50

steam-overlay
    location: /var/lib/layman/steam-overlay
    masters: gentoo
    priority: 50

toolchain
    location: /var/lib/layman/toolchain
    masters: gentoo
    priority: 50

x11
    location: /var/lib/layman/x11
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-march=native -O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs ccache config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=native -O2 -pipe"
GENTOO_MIRRORS="http://mirrors.163.com/gentoo/"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="zh_CN zh_TW en_US"
MAKEOPTS="-j8 -l12"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 aac acl acpi alsa amd64 apm bash-completion berkdb bluetooth branding bzip2 cairo cdda cdr cjk cli colord crypt cups cxx dbus dri dts dvd dvdr eds emacs emboss encode evo exif fam flac fortran gdbm gif gnome gnome-keyring gnome-online-accounts gpm gstreamer gtk iconv icu introspection ipv6 jpeg kms lcms ldap libnotify libsecret libtirpc mad man mng mp3 mp4 mpeg multilib nautilus ncurses networkmanager nls nptl nsplugin ogg opengl openmp pam pango pcre pdf png policykit ppds pulseaudio pypy python qt5 readline sdl seccomp spell split-usr ssl startup-notification svg systemd tcpd tiff tracker truetype udev udisks unicode upower usb vim vim-syntax vorbis wayland wxwidgets x264 xattr xcb xml xv xvid zlib" ABI_X86="64 32" ADA_TARGET="gnat_2018" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 ssse3 sse4 sse4_1 sse4_2 avx aes fma aes-ni popcnt" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" L10N="zh-CN zh-TW en-US zh en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" NETBEANS_MODULES="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" RUBY_TARGETS="ruby24 ruby25" USERLAND="GNU" VIDEO_CARDS="amdgpu radeonsi radeon" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 3 Liu Yang 2019-12-18 08:26:50 UTC
The coredump file is too big to be uploaded as attachment, it is about 35MiB big.
Comment 4 Ulrich Müller gentoo-dev 2019-12-19 04:58:52 UTC
Can you run emacs under gdb and attach a backtrace here ("bt full")?
Comment 5 Liu Yang 2019-12-19 12:37:27 UTC
(In reply to Ulrich Müller from comment #4)
> Can you run emacs under gdb and attach a backtrace here ("bt full")?
Below is the out put of my gdb, is that enough?

(gdb) exec-file /usr/bin/emacs
(gdb) r
Starting program: /usr/bin/emacs 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7ffff2e6f700 (LWP 1075794)]
[New Thread 0x7ffff262e700 (LWP 1075795)]
[New Thread 0x7ffff13a2700 (LWP 1075802)]
[Detaching after vfork from child process 1075812]
[Detaching after vfork from child process 1075859]
[Detaching after vfork from child process 1075874]
[New Thread 0x7ffff0605a00 (LWP 1075923)]
[Thread 0x7ffff0605a00 (LWP 1075923) exited]
[New Thread 0x7ffff0605a00 (LWP 1075926)]
[Thread 0x7ffff0605a00 (LWP 1075926) exited]
[Detaching after vfork from child process 1075971]
[Detaching after vfork from child process 1075975]
[Detaching after vfork from child process 1075976]
[Detaching after vfork from child process 1075989]
[Detaching after vfork from child process 1076001]

Thread 1 "emacs" received signal SIGSEGV, Segmentation fault.
0x00007ffff6f97950 in XftCharIndex () from /usr/lib64/libXft.so.2
(gdb) bt full
#0  0x00007ffff6f97950 in XftCharIndex () at /usr/lib64/libXft.so.2
#1  0x00000000005d73c9 in  ()
#2  0x0000000000000047 in  ()
#3  0x000000000045d6b5 in  ()
#4  0x00017fffffff9040 in  ()
#5  0x00007fffffff8d08 in  ()
#6  0x00007fffffff8cd8 in  ()
#7  0x00007fffffff8d36 in  ()
#8  0x00007fffffff9180 in  ()
#9  0x6b5e913678a34000 in  ()
#10 0x0000000000000000 in  ()
Comment 6 Liu Yang 2019-12-20 02:18:59 UTC
$ emacs
Fatal error 11: Segmentation fault
Backtrace:
emacs[0x50a06e]
emacs[0x4efe3d]
emacs[0x5084ee]
emacs[0x50871d]
emacs[0x508799]
/lib64/libpthread.so.0(+0x14590)[0x7f33b31b7590]
/usr/lib64/libXft.so.2(XftCharIndex+0x0)[0x7f33b3947950]
emacs[0x5d73c9]
emacs[0x45d6b5]
emacs[0x4342e6]
emacs[0x440b05]
emacs[0x44997c]
emacs[0x4532ce]
emacs[0x433053]
emacs[0x457beb]
emacs[0x457efb]
emacs[0x458138]
emacs[0x55c245]
emacs[0x56640c]
emacs[0x5a3e9b]
emacs[0x56638b]
emacs[0x5680fc]
emacs[0x5688b2]
emacs[0x5691a4]
emacs[0x5687ab]
emacs[0x569fb1]
emacs[0x5687ab]
emacs[0x568dd8]
emacs[0x56638b]
emacs[0x5680fc]
emacs[0x56640c]
emacs[0x5a3e9b]
emacs[0x56638b]
emacs[0x5a3e9b]
emacs[0x56638b]
emacs[0x566429]
emacs[0x5659ed]
emacs[0x565c05]
emacs[0x56640c]
emacs[0x5a3e9b]
emacs[0x56638b]
...
Segmentation fault (core dumped)
Comment 7 Ulrich Müller gentoo-dev 2019-12-20 06:33:31 UTC
(In reply to Liu Yang from comment #2)
> $ emerge --info
> [...]
> CFLAGS="-march=native -O2 -pipe"
> CXXFLAGS="-march=native -O2 -pipe"

Sorry, I had missed that debugging symbols aren't enabled in your flags. Without symbols, these backtraces aren't very useful.

Could you reinstall x11-libs/libXft and app-editors/emacs with "-ggdb" added to your flags?
Comment 8 Liu Yang 2019-12-20 10:40:34 UTC
Created attachment 600186 [details]
bt full output in gdb

this is the output in gdb.
Comment 9 Liu Yang 2019-12-20 10:42:00 UTC
(In reply to Ulrich Müller from comment #7)
> (In reply to Liu Yang from comment #2)
> > $ emerge --info
> > [...]
> > CFLAGS="-march=native -O2 -pipe"
> > CXXFLAGS="-march=native -O2 -pipe"
> 
> Sorry, I had missed that debugging symbols aren't enabled in your flags.
> Without symbols, these backtraces aren't very useful.
> 
> Could you reinstall x11-libs/libXft and app-editors/emacs with "-ggdb" added
> to your flags?

I have rebuilt libXft, emacs and glibc with flag "-ggdb" and feature nostrip, but the output in gdb is too big to be pasted in comment, so I uploaded it as an attachment.
Comment 10 Ulrich Müller gentoo-dev 2019-12-20 13:15:43 UTC
(In reply to Liu Yang from comment #8)
> Created attachment 600186 [details]
> bt full output in gdb

(gdb) bt full
#0  0x00007ffff6f97950 in XftCharIndex (dpy=0x2a7f6b0, pub=0x0, ucs4=92) at /var/tmp/portage/x11-libs/libXft-2.3.3/work/libXft-2.3.3/src/xftglyphs.c:836
        font = 0x0
        ent = <optimized out>
        offset = <optimized out>
        face = <optimized out>
#1  0x00000000005d73c9 in xftfont_encode_char (font=<optimized out>, c=<optimized out>) at xftfont.c:554
        xftfont_info = <optimized out>
        code = <optimized out>

OK, so xftfont_info->xftfont is a null pointer, and it is passed as second argument to XftCharIndex. Then the function tries to dereference it.

Does the segmentation fault happen when you start Emacs ("emacs -Q"), or only when you visit a certain file? In other words, do you have a recipe for me to reproduce the problem?
Comment 11 Liu Yang 2019-12-22 09:45:26 UTC
(In reply to Ulrich Müller from comment #10)
> (In reply to Liu Yang from comment #8)
> > Created attachment 600186 [details]
> > bt full output in gdb
> 
> (gdb) bt full
> #0  0x00007ffff6f97950 in XftCharIndex (dpy=0x2a7f6b0, pub=0x0, ucs4=92) at
> /var/tmp/portage/x11-libs/libXft-2.3.3/work/libXft-2.3.3/src/xftglyphs.c:836
>         font = 0x0
>         ent = <optimized out>
>         offset = <optimized out>
>         face = <optimized out>
> #1  0x00000000005d73c9 in xftfont_encode_char (font=<optimized out>,
> c=<optimized out>) at xftfont.c:554
>         xftfont_info = <optimized out>
>         code = <optimized out>
> 
> OK, so xftfont_info->xftfont is a null pointer, and it is passed as second
> argument to XftCharIndex. Then the function tries to dereference it.
> 
> Does the segmentation fault happen when you start Emacs ("emacs -Q"), or
> only when you visit a certain file? In other words, do you have a recipe for
> me to reproduce the problem?

I found that crash related to my ~/.emacs.d/.emacs.desktop file, there were some strange characters in it. Emacs won't crash after this file removed. after this a new file with same name will be generated but no strange characters in, and the Emacs won't crash any more. I'm not sure whether it's still a bug of emacs. I that necessary to upload the file which caused the crash?
Comment 12 Ulrich Müller gentoo-dev 2019-12-23 19:08:56 UTC
(In reply to Liu Yang from comment #11)
> I found that crash related to my ~/.emacs.d/.emacs.desktop file, there were
> some strange characters in it. Emacs won't crash after this file removed.
> after this a new file with same name will be generated but no strange
> characters in, and the Emacs won't crash any more. I'm not sure whether it's
> still a bug of emacs. I that necessary to upload the file which caused the
> crash?

If you think that you have found a bug in Emacs (probably you have, because it shouldn't segfault because of an .emacs.desktop file), then it might make more sense to report this to Emacs upstream. There is very little we can do about this on the distro level.
Comment 13 Liu Yang 2019-12-24 11:49:45 UTC
(In reply to Ulrich Müller from comment #12)
> (In reply to Liu Yang from comment #11)
> > I found that crash related to my ~/.emacs.d/.emacs.desktop file, there were
> > some strange characters in it. Emacs won't crash after this file removed.
> > after this a new file with same name will be generated but no strange
> > characters in, and the Emacs won't crash any more. I'm not sure whether it's
> > still a bug of emacs. I that necessary to upload the file which caused the
> > crash?
> 
> If you think that you have found a bug in Emacs (probably you have, because
> it shouldn't segfault because of an .emacs.desktop file), then it might make
> more sense to report this to Emacs upstream. There is very little we can do
> about this on the distro level.

Thanks, got it. I will confirm that, that may not be a bug of distro level. If it is a bug of Emacs itself, I will report it to upstream. And on that condition is this bug should be closed?
Comment 14 Ulrich Müller gentoo-dev 2019-12-24 12:13:04 UTC
Yes, we'll close this bug as "RESOLVED UPSTREAM" then, with a pointer to the upstream bug.

Also, you may include a reference to this Gentoo bug in the upstream bug report.
Comment 15 Ulrich Müller gentoo-dev 2020-10-03 15:45:53 UTC
No reply. Closing.