Subject: 29.0.50; Segfault in ERT test

From: Helmut Eller <[email-masked]>
Date: Mon, 11 Oct 2021 08:07:34 +0200

Emacs receives a segmentation fault when executing this file:

  (ert-deftest segfault ()
    (let ((debug-on-error nil))
      (error "foo")))
  
with

  emacs -Q -batch -l /tmp/test.el -f ert-run-tests-batch-and-exit

The backtrace in gdb is very long and seems to show an endless recursion
in Fsignal:

gdb -q --args emacs -Q -batch -l /tmp/test.el -f ert-run-tests-batch-and-exit
Reading symbols from emacs...
(gdb) r
Starting program: /home/helmut/bin/emacs -Q -batch -l /tmp/test.el -f ert-run-tests-batch-and-exit
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff228c700 (LWP 10498)]
Running 1 tests (2021-10-11 08:04:00+0200, selector ‘t’)

Thread 1 "emacs" received signal SIGSEGV, Segmentation fault.
0x00005555556ff741 in signal_or_quit (error_symbol=0xfc60, 
    data=0x555556079a53, keyboard_quit=false) at eval.c:1768
1768    {
(gdb) bt 20
#0  0x00005555556ff741 in signal_or_quit
    (error_symbol=0xfc60, data=0x555556079a53, keyboard_quit=false)
    at eval.c:1768
#1  0x0000555555599594 in Fsignal (error_symbol=<optimized out>, 
    error_symbol@entry=0xfc60, data=<optimized out>) at eval.c:1750
#2  0x000055555559974d in xsignal (data=<optimized out>, error_symbol=0xfc60)
    at lisp.h:4152
#3  xsignal2
    (error_symbol=error_symbol@entry=0xfc60, arg1=arg1@entry=0xdb00, arg2=arg2@entry=0x555555dc33a5) at eval.c:1913
#4  0x00005555555987f0 in wrong_type_argument
    (predicate=predicate@entry=0xdb00, value=value@entry=0x555555dc33a5)
    at data.c:143
#5  0x000055555559985e in CHECK_TYPE (x=0x555555dc33a5, predicate=0xdb00, ok=0)
    at lisp.h:759
#6  CHECK_SYMBOL (x=0x555555dc33a5) at lisp.h:1028
#7  specbind (symbol=0x555555dc33a5, value=<optimized out>) at eval.c:3542
#8  0x00005555556ffbf5 in signal_or_quit
    (error_symbol=<optimized out>, data=0x555556079a23, keyboard_quit=<optimized out>) at lisp.h:1002
#9  0x0000555555599594 in Fsignal (error_symbol=<optimized out>, 
    error_symbol@entry=0xfc60, data=<optimized out>) at eval.c:1750
#10 0x000055555559974d in xsignal (data=<optimized out>, error_symbol=0xfc60)
    at lisp.h:4152
#11 xsignal2
    (error_symbol=error_symbol@entry=0xfc60, arg1=arg1@entry=0xdb00, arg2=arg2@entry=0x555555dc33a5) at eval.c:1913
#12 0x00005555555987f0 in wrong_type_argument
    (predicate=predicate@entry=0xdb00, value=value@entry=0x555555dc33a5)
    at data.c:143
#13 0x000055555559985e in CHECK_TYPE (x=0x555555dc33a5, predicate=0xdb00, ok=0)
    at lisp.h:759
#14 CHECK_SYMBOL (x=0x555555dc33a5) at lisp.h:1028
#15 specbind (symbol=0x555555dc33a5, value=<optimized out>) at eval.c:3542
#16 0x00005555556ffbf5 in signal_or_quit
    (error_symbol=<optimized out>, data=0x5555560799f3, keyboard_quit=<optimized out>) at lisp.h:1002
#17 0x0000555555599594 in Fsignal (error_symbol=<optimized out>, 
    error_symbol@entry=0xfc60, data=<optimized out>) at eval.c:1750
#18 0x000055555559974d in xsignal (data=<optimized out>, error_symbol=0xfc60)
    at lisp.h:4152
#19 xsignal2
    (error_symbol=error_symbol@entry=0xfc60, arg1=arg1@entry=0xdb00, arg2=arg2@entry=0x555555dc33a5) at eval.c:1913
(More stack frames follow...)
(gdb) 

Helmut

In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0)
 of 2021-10-06 built on caladan
Repository revision: 597b6deb294ace9178c8927f83ec08b92597b347
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux 11 (bullseye)

Configured using:
 'configure --with-xpm=ifavailable --with-jpeg=ifavailable
 --with-gif=ifavailable --with-tiff=ifavailable'

Configured features:
CAIRO DBUS FREETYPE GLIB GMP GNUTLS GSETTINGS HARFBUZZ LIBSELINUX
LIBSYSTEMD LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG SECCOMP SOUND
THREADS TOOLKIT_SCROLL_BARS X11 XDBE XIM GTK3 ZLIB

Important settings:
  value of $LANG: C.UTF-8
  locale-coding-system: utf-8-unix