Subject: bug#78616: 31.0.50; gnustep build segfault

From: martin rudalics <[email-masked]>
Date: Wed, 28 May 2025 12:09:28 +0200

commit ba20f73d8e0173a37fbdd2efe72a7a3b0d62dfa5
Author: Gerd Möllmann <[email-masked]>
Date:   Sun Mar 9 11:47:35 2025 +0100

     macOS: Don't constrainFrameRect for child frames

     * src/nsterm.m ([EmacsWindow constrainFrameRect:toScreen:]): Don't do
     anything for child frames.

causes the gnustep build configured as

"CFLAGS='-O0 -g3 -no-pie -std=gnu99 -Wno-missing-prototypes -Wno-expansion-to-defined -Wno-redundant-decls -Wno-old-style-definition -Wno-strict-prototypes' ../configure --with-gnutls=no --without-pop --without-harfbuzz --with-ns"

to fail thusly

(gdb) run -Q
Starting program: /home/martin/emacs-git/trunk/obj-ns/src/emacs -Q
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffed0556c0 (LWP 22759)]
[Detaching after vfork from child process 22760]

Thread 1 "emacs" received signal SIGSEGV, Segmentation fault.
-[EmacsWindow constrainFrameRect:toScreen:] (self=0x35d11d0, _cmd=<optimized out>, frameRect=..., screen=<optimized out>) at ../../src/nsterm.m:9805
9805	  if (FRAME_PARENT_FRAME (f))
(gdb) bt
#0  -[EmacsWindow constrainFrameRect:toScreen:] (self=0x35d11d0, _cmd=<optimized out>, frameRect=..., screen=<optimized out>) at ../../src/nsterm.m:9805
#1  0x00007ffff7beae35 in  () at /lib/libgnustep-gui.so.0.29
#2  0x0000000000703673 in -[EmacsWindow setFrame:display:] (self=0x35d11d0, _cmd=<optimized out>, windowFrame=..., displayViews=<optimized out>) at ../../src/nsterm.m:9996
#3  0x00007ffff7be799e in  () at /lib/libgnustep-gui.so.0.29
#4  0x00007ffff7be1007 in  () at /lib/libgnustep-gui.so.0.29
#5  0x000000000070c61e in -[EmacsWindow initWithEmacsFrame:fullscreen:screen:] (self=0x35d11d0, _cmd=<optimized out>, f=0xce3ba8, fullscreen=<optimized out>, screen=0x0) at ../../src/nsterm.m:9374
#6  0x000000000070b09d in -[EmacsView initFrameFromEmacs:] (self=0xf71530, _cmd=<optimized out>, f=0xce3ba8) at ../../src/nsterm.m:8185
#7  0x000000000071fd6a in Fx_create_frame (parms=XIL(0x7ffff190e3b3)) at ../../src/nsfns.m:1504
#8  0x0000000000647251 in funcall_subr (subr=0x81b760 <Sx_create_frame>, numargs=1, args=0x7fffefbff308) at ../../src/eval.c:3219
#9  0x000000000069b83c in exec_byte_code (fun=XIL(0x7ffff0696ebd), args_template=770, nargs=3, args=0x7fffefbff370) at ../../src/bytecode.c:812
#10 0x0000000000647800 in funcall_lambda (fun=XIL(0x7ffff0708bb5), nargs=1, arg_vector=0x7fffefbff220) at ../../src/eval.c:3310
#11 0x0000000000646d32 in funcall_general (fun=XIL(0x7ffff0708bb5), numargs=1, args=0x7fffefbff220) at ../../src/eval.c:3102
#12 0x0000000000646f97 in Ffuncall (nargs=2, args=0x7fffefbff218) at ../../src/eval.c:3151
#13 0x000000000064611a in Fapply (nargs=2, args=0x7fffefbff218) at ../../src/eval.c:2780
#14 0x000000000064748a in funcall_subr (subr=0x814b20 <Sapply>, numargs=2, args=0x7fffefbff218) at ../../src/eval.c:3242
#15 0x000000000069b83c in exec_byte_code (fun=XIL(0x7ffff0d5c63d), args_template=770, nargs=3, args=0x7fffefbff490) at ../../src/bytecode.c:812
#16 0x0000000000647800 in funcall_lambda (fun=XIL(0x7ffff0d8343d), nargs=0, arg_vector=0x7fffffffe200) at ../../src/eval.c:3310
#17 0x0000000000647697 in apply_lambda (fun=XIL(0x7ffff0d8343d), args=XIL(0), count=...) at ../../src/eval.c:3273
#18 0x0000000000645ce8 in eval_sub (form=XIL(0x7ffff1078223)) at ../../src/eval.c:2703
#19 0x0000000000645308 in Feval (form=XIL(0x7ffff1078223), lexical=XIL(0x30)) at ../../src/eval.c:2520
#20 0x0000000000581ec9 in top_level_2 () at ../../src/keyboard.c:1179
#21 0x0000000000643614 in internal_condition_case (bfun=0x581e62 <top_level_2>, handlers=XIL(0x90), hfun=0x581774 <cmd_error>) at ../../src/eval.c:1684
#22 0x0000000000581f31 in top_level_1 (ignore=XIL(0)) at ../../src/keyboard.c:1191
#23 0x0000000000642ba1 in internal_catch (tag=XIL(0x11c70), func=0x581ee2 <top_level_1>, arg=XIL(0)) at ../../src/eval.c:1364
#24 0x0000000000581d9d in command_loop () at ../../src/keyboard.c:1140
#25 0x0000000000581316 in recursive_edit_1 () at ../../src/keyboard.c:749
#26 0x00000000005814c2 in Frecursive_edit () at ../../src/keyboard.c:832
#27 0x000000000057d6fb in main (argc=2, argv=0x7fffffffe808) at ../../src/emacs.c:2582

Lisp Backtrace:
"x-create-frame" (0xefbff308)
"x-create-frame-with-faces" (0xefbff2a0)
0xf0708bb0 PVEC_CLOSURE
"apply" (0xefbff218)
"frame-creation-function" (0xefbff1b8)
"make-frame" (0xefbff138)
"frame-initialize" (0xefbff0b8)
"command-line" (0xefbff040)
"normal-top-level" (0xffffe200)
(gdb)

martin