Subject: bug#71176: 30.0.50; Segmentation fault (SIGSEGV) in TTY+emacsclient, default_face is nil

From: Daniel Clemente <[email-masked]>
Date: Mon, 27 May 2024 11:04:50 +0000

> I've now installed the necessary changes on the master branch, so
> please from now on use only the latest master branch for testing this
> issue, to avoid the possibility of some wild goose chase.

I'm using the master branch now, and it works as expected, and fixes this
bug. Thanks.

On Sun, 26 May 2024 at 16:44, Eli Zaretskii <[email-masked]> wrote:

> > From: Daniel Clemente <[email-masked]>
> > Date: Sun, 26 May 2024 11:04:30 +0000
> > Cc: [email-masked]
> >
> > Wait, it just crashed on me, seconds after my last message.  I just
> opened 1 normal frame (not a loop) and
> > this happened.
> >
> > Program received signal SIGSEGV, Segmentation fault.
> > 0x00005555556693a0 in face_at_buffer_position (w=0x555556aa7860, pos=1,
> endptr=0x7fffffff7668,
> > limit=101, mouse=false, base_face_id=0, attr_filter=0) at xfaces.c:6827
> > 6827      return default_face->id;
> > (gdb) bt
> > #0  0x00005555556693a0 in face_at_buffer_position (w=0x555556aa7860,
> pos=1, endptr=0x7fffffff7668,
> > limit=101, mouse=false, base_face_id=0, attr_filter=0) at xfaces.c:6827
> > #1  0x00005555555a9452 in face_at_pos (it=0x7fffffff7810, attr_filter=0)
> at xdisp.c:4670
> > #2  0x00005555555a9749 in handle_face_prop (it=0x7fffffff7810) at
> xdisp.c:4771
> > #3  0x00005555555a7f3a in handle_stop (it=0x7fffffff7810) at xdisp.c:4136
> > #4  0x00005555555b0f73 in reseat (it=0x7fffffff7810, pos=...,
> force_p=true) at xdisp.c:7813
> > #5  0x00005555555a6d33 in init_iterator (it=0x7fffffff7810,
> w=0x555556aa7860, charpos=1, bytepos=1,
> > row=0x0, base_face_id=DEFAULT_FACE_ID) at xdisp.c:3507
> > #6  0x00005555555bed38 in resize_mini_window (w=0x555556aa7860,
> exact_p=false) at xdisp.c:12987
> > #7  0x00005555555be3a9 in display_echo_area_1 (a1=0x555556aa7860,
> a2=XIL(0)) at xdisp.c:12874
> > #8  0x00005555555bda95 in with_echo_area_buffer (w=0x555556aa7860,
> which=0, fn=0x5555555be37b
> > <display_echo_area_1>, a1=0x555556aa7860, a2=XIL(0)) at xdisp.c:12646
> > #9  0x00005555555be328 in display_echo_area (w=0x555556aa7860) at
> xdisp.c:12842
> > #10 0x00005555555c00cb in echo_area_display (update_frame_p=true) at
> xdisp.c:13400
> > #11 0x00005555555bcfcd in message3_nolog (m=XIL(0x5555566175f4)) at
> xdisp.c:12348
> > #12 0x00005555555bd079 in message1_nolog (m=0x55555580f792 "Garbage
> collecting...") at xdisp.c:12376
> > #13 0x00005555557011e5 in garbage_collect () at alloc.c:6587
> > #14 0x0000555555700fe3 in maybe_garbage_collect () at alloc.c:6507
> > #15 0x000055555572fb69 in maybe_gc () at /w/emacs/src/lisp.h:5929
> > #16 0x00005555557368cd in Ffuncall (nargs=3, args=0x7fffffff8f30) at
> eval.c:3088
> > #17 0x000055555565ef76 in tty_lookup_color (f=0x5555563d2718,
> color=XIL(0x5555566175b4),
> > tty_color=0x7fffffff9070, std_color=0x0) at xfaces.c:1050
> > #18 0x000055555565f204 in tty_defined_color (f=0x5555563d2718,
> color_name=0x7ffff24627a0
> > "unspecified-bg", color_def=0x7fffffff9070, alloc=true, _makeIndex=true)
> at xfaces.c:1113
> > #19 0x000055555565f681 in load_color2 (f=0x5555563d2718,
> face=0x55555656e3c0, name=XIL
> > (0x7ffff1ea5b44), target_index=LFACE_BACKGROUND_INDEX,
> color=0x7fffffff9070) at xfaces.c:1260
> > #20 0x000055555565f815 in load_color (f=0x5555563d2718,
> face=0x55555656e3c0, name=XIL
> > (0x7ffff1ea5b44), target_index=LFACE_BACKGROUND_INDEX) at xfaces.c:1323
> > #21 0x000055555566883e in map_tty_color (f=0x5555563d2718,
> face=0x55555656e3c0, color=XIL
> > (0x7ffff1ea5b44), idx=LFACE_BACKGROUND_INDEX, defaulted=0x7fffffff9147)
> at xfaces.c:6510
> > #22 0x0000555555668d59 in realize_tty_face (cache=0x555556a643c0,
> attrs=0x7fffffff91f0) at xfaces.c:6660
> > #23 0x0000555555668688 in realize_face (cache=0x555556a643c0,
> attrs=0x7fffffff91f0, former_face_id=0)
> > at xfaces.c:6062
> > #24 0x000055555566842d in realize_default_face (f=0x5555563d2718) at
> xfaces.c:5970
>
> It's another call to realize_face which realizes the default face, so
> it needs the same protection.
>
> I've now installed the necessary changes on the master branch, so
> please from now on use only the latest master branch for testing this
> issue, to avoid the possibility of some wild goose chase.
>
> Thanks.
>