Subject: Re: bug#72692: Emacs 31.05 (40eecd594ac) get SIGSEGV on Linux (Linux 6.6.45 Kde Wayland)

From: Eval EXEC <[email-masked]>
Date: Sun, 18 Aug 2024 17:08:47 +0800

the "p *face" in "frame 9" is:
```
(gdb) frame 9
#9  0x00000000006dd64d in fontset_font (fontset=fontset@entry=0x0, 
c=c@entry=127802, face=face@entry=0x13fec610, id=-1) at fontset.c:793
793       rfont_def = fontset_find_font (fontset, c, face, id, 0);
(gdb) p *face
$1 = {lface = {0x8220, 0x28bdef4, 0x28bdf34, 0xe340, 0x16a, 0xe340, 
0xe340, 0x0, 0x0, 0x4417994, 0x233c9c4, 0x0, 0x0, 0x0, 0x7f9ea6b05d63, 
0xbdc613ad, 0x0, 0x2aabee4, 0x13500, 0x0}, id = 40, gc = 0x0, stipple = 0,
  foreground = 4288059542, background = 4278190080, underline_color = 0, 
overline_color = 0, strike_through_color = 0, box_color = 4281545523, 
font = 0x1e4970c0, fontset = 26, box_vertical_line_width = -1,
  box_horizontal_line_width = -1, underline_pixels_above_descent_line = 
0, box = FACE_SIMPLE_BOX, underline = FACE_NO_UNDERLINE, 
use_box_color_for_shadows_p = true, overline_p = false, strike_through_p 
= false,
  foreground_defaulted_p = false, background_defaulted_p = false, 
underline_defaulted_p = false, overline_color_defaulted_p = false, 
strike_through_color_defaulted_p = false, box_color_defaulted_p = true,
  underline_at_descent_line_p = false, tty_bold_p = false, tty_italic_p 
= false, tty_reverse_p = false, tty_strike_through_p = false, 
colors_copied_bitwise_p = true, overstrike = false, hash = 322003229,
  next = 0x54da8550, prev = 0x4d7343a0, ascii_face = 0x4d7343a0, extra = 
0x0}
(gdb)
```

> c is ?🌺 .  Are you using that character in your mode line, by any
chance?  Does it show up for you in Emacs?

Yes, I'm using the flower emoji in treemacs, related customize config is:
```elisp
(setq    treemacs-user-mode-line-format
   '(:eval (format "🌳🌺🌻: %s :🌽🍅🥦"
                                       (treemacs-project->name
                     (car (treemacs-workspace->projects 
(treemacs-current-workspace)))
                     )
                    )
            )
   )
```

I executed ```
(gdb) source 
/home/exec/Projects/git.savannah.gnu.org/git/emacs/src/.gdbinit
......
Breakpoint 5 at 0x4736d9: file emacs.c, line 431.
Breakpoint 6 at 0x562640: file xterm.c, line 27093.
(gdb) pp Vfontset_table
Cannot access memory at address 0xc82684
(gdb)

```

after I source the 
`/home/exec/Projects/git.savannah.gnu.org/git/emacs/src/.gdbinit` file 
in gdb. then I switch to frame 9:

got:

```

(gdb) frame 9
#9  0x00000000006dd64d in fontset_font (fontset=fontset@entry=XIL(0), 
c=c@entry=127802, face=face@entry=0x13fec610, id=-1) at fontset.c:793
793       rfont_def = fontset_find_font (fontset, c, face, id, 0);
(gdb) p *face
$4 = {
   lface = {XIL(0x8220), XIL(0x28bdef4), XIL(0x28bdf34), XIL(0xe340), 
make_fixnum(90), XIL(0xe340), XIL(0xe340), XIL(0), XIL(0), 
XIL(0x4417994), XIL(0x233c9c4), XIL(0), XIL(0), XIL(0), XIL(0x7f9ea6b05d63),
     XIL(0xbdc613ad), XIL(0), XIL(0x2aabee4), XIL(0x13500), XIL(0)},
   id = 40,
   gc = 0x0,
   stipple = 0,
   foreground = 4288059542,
   background = 4278190080,
   underline_color = 0,
   overline_color = 0,
   strike_through_color = 0,
   box_color = 4281545523,
   font = 0x1e4970c0,
   fontset = 26,
   box_vertical_line_width = -1,
   box_horizontal_line_width = -1,
   underline_pixels_above_descent_line = 0,
   box = FACE_SIMPLE_BOX,
   underline = FACE_NO_UNDERLINE,
   use_box_color_for_shadows_p = true,
   overline_p = false,
   strike_through_p = false,
   foreground_defaulted_p = false,
   background_defaulted_p = false,
   underline_defaulted_p = false,
   overline_color_defaulted_p = false,
   strike_through_color_defaulted_p = false,
   box_color_defaulted_p = true,
   underline_at_descent_line_p = false,
   tty_bold_p = false,
   tty_italic_p = false,
   tty_reverse_p = false,
   tty_strike_through_p = false,
   colors_copied_bitwise_p = true,
   overstrike = false,
   hash = 322003229,
   next = 0x54da8550,
   prev = 0x4d7343a0,
   ascii_face = 0x4d7343a0,
   extra = 0x0
}
(gdb)
```

On 8/18/24 16:58, Pip Cet wrote:
> "Eval EXEC"<[email-masked]>  writes:
>
>> I'm help to tesing Emacs master branch (commit: 40eecd594ac) on Linux.
> Thank you!
>
>> I compile emacs source code by:
>>
>> ```bash
>>
>> make extraclean
>> ./autogen.sh \
>>     && ./configure \
>>     --prefix=$(realpath ../emacs-build/$(git branch --show-current | sed
>> 's/\//_/g'))\
>>     --with-imagemagick --with-xwidgets \
>>     --with-modules --with-x-toolkit=gtk3 --without-compress-install \
>>     --without-toolkit-scroll-bars --with-native-compilation --with-mailutils\
>>     --with-tree-sitter --with-xinput2  \
>>     --with-dbus  --with-native-compilation=aot \
>>     --with-file-notification=inotify\
>>     && make -j30 install
>> ```
> You might want to consider adding --enable-checking and CFLAGS="-O0 -g3
> -ggdb" or equivalent to that until this bug has been found.
>
>> When I using emacs, I got crash, the backtrace is :
>>
>> ```
>>
>> line to your configuration file "/home/exec/.config/gdb/gdbinit".
>> For more information about this security protection see the
>> "Auto-loading safe path" section in the GDB manual.  E.g., run from the
>> shell:
>>           info "(gdb)Auto-loading safe path"
>> warning: File
>> "/nix/store/x47hg342iyiw50c1fhqjzz4n0rqy3dhh-isl-0.20/lib/libisl.so.19.1.0-gdb.py"
>> auto-loading has been declined by your `auto-load safe-path' set to
>> "$debugdir:$datadir/auto-load:/nix/store/40yjzm7r5ki59kkk9423dnwbm86x7pyd-gcc-13.2.0-lib".
>> (gdb) c
>> The program is not being run.
>> (gdb) bt
>> #0  0x00007f9eaeea2efc in __pthread_kill_implementation () from
>> /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
>> #1  0x00007f9eaee52e86 in raise () from
>> /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
>> #2  0x0000000000473791 in terminate_due_to_signal (sig=sig@entry=11,
>> backtrace_limit=backtrace_limit@entry=40) at emacs.c:469
>> #3  0x0000000000473ccd in handle_fatal_signal (sig=sig@entry=11) at
>> sysdep.c:1800
>> #4  0x00000000005c4bf8 in deliver_thread_signal (sig=sig@entry=11,
>> handler=0x473cc2 <handle_fatal_signal>) at sysdep.c:1792
>> #5  0x00000000005c4c7c in deliver_fatal_thread_signal (sig=11) at
>> sysdep.c:1812
>> #6  handle_sigsegv (sig=11, siginfo=<optimized out>, arg=<optimized
>> out>) at sysdep.c:1950
>> #7  <signal handler called>
>> #8  fontset_find_font (fontset=fontset@entry=0x0, c=c@entry=127802,
>> face=face@entry=0x13fec610, charset_id=charset_id@entry=-1,
>> fallback=fallback@entry=false)
>>       at /home/exec/Projects/git.savannah.gnu.org/git/emacs/src/lisp.h:2127
>> #9  0x00000000006dd64d in fontset_font (fontset=fontset@entry=0x0,
>> c=c@entry=127802, face=face@entry=0x13fec610, id=-1) at fontset.c:793
> Do you still have the core file?
>
> Can you print *face in this stack frame? The relevant gdb commands are
> "frame 9" followed by "p *face".
>
> c is ?🌺 .  Are you using that character in your mode line, by any
> chance?  Does it show up for you in Emacs?
>
>> I believe the crash is related to the font, but I can't reproduce it. It
>> happens about once a day.
> What would also be helpful would be to source .gdbinit from your src/
> directory, (gdb:
> "source/home/exec/Projects/git.savannah.gnu.org/git/emacs/src/.gdbinit"),
> then "pp Vfontset_table" to see how large it is.
>
> Thanks!
>
> Pip
>