Subject: bug#76970: 31.0.50; master emacs crash with stack overflow

From: Aaron Zeng <[email-masked]>
Date: Tue, 1 Jul 2025 12:17:45 -0400

On Tue, Jun 24, 2025 at 1:46 AM Pip Cet <[email-masked]> wrote:
> The original fix was incomplete, please try applying this one, too:
>
> diff --git a/src/eval.c b/src/eval.c
> index 46705dc4543..20782639990 100644
> --- a/src/eval.c
> +++ b/src/eval.c
> @@ -159,7 +159,11 @@ set_backtrace_debug_on_exit (union specbinding *pdl, bool doe)
>
>  bool
>  backtrace_p (union specbinding *pdl)
> -{ return specpdl ? pdl >= specpdl : false; }
> +{
> +  if (current_thread && specpdl && pdl)
> +    return pdl >= specpdl;
> +  return false;
> +}
>
>  static bool
>  backtrace_thread_p (struct thread_state *tstate, union specbinding *pdl)

After installing that patch as well, it does seem to have helped a
lot.  I was seeing segfaults every couple of hours and I haven't seen
one in several days.

Thanks, Pip!