Subject: Re: bug#44502:

From: Alan Mackenzie <[email-masked]>
Date: Sun, 14 Aug 2022 14:30:04 +0000

Hello, Andrei.

On Fri, Aug 12, 2022 at 13:24:27 +0300, [email-masked] wrote:
> Salve Eli!

> >> From: [email-masked]
> >> Cc: [email-masked]
> >> Date: Thu, 11 Aug 2022 22:10:12 +0300

> >> Eli Zaretskii <[email-masked]> writes:

> >> >> From: [email-masked]
> >> >> Cc: [email-masked]
> >> >> Date: Thu, 11 Aug 2022 21:19:06 +0300

> >> >> (gdb) p window
> >> >> $4 = XIL(0x55555b038855)
> >> >> (gdb) xwindow
> >> >> $5 = (struct window *) 0x55555b038850
> >> >> 124x1+0+80
> >> >> (gdb) print XWINDOW(window)->contents
> >> >> $6 = XIL(0x7fffea1bd07d)
> >> >> (gdb) xbuffer
> >> >> $7 = (struct buffer *) 0x7fffea1bd078
> >> >> 0x7fffea4aedc1 " *Minibuf-0*"
> >> >> (gdb) print selected_window
> >> >> $8 = XIL(0x55555b038645)
> >> >> (gdb) xwindow
> >> >> $9 = (struct window *) 0x55555b038640
> >> >> 124x80+0+0
> >> >> (gdb) print XWINDOW(selected_window)->contents
> >> >> $10 = XIL(0x5555577f9475)
> >> >> (gdb) xbuffer
> >> >> $11 = (struct buffer *) 0x5555577f9470
> >> >> 0x555559788ff0 "magit: A<10.6>"

> >> > Do you remember what were you doing when this assertion violation
> >> > happened?

> >> Something like

> >>   C-u M-x shell

I've tried quite a bit to reproduce the error, but haven't managed.

> >> > Also, are you using a separate minibuffer frame?

> There are still *two* asserted emacs' frames around with "Minibuffer-1"
> (not 0!) around.

I think I understand what has caused the breakage of this assertion, and
as Eli suggested, it is something fairly harmless.

> >> No

> > Then I tend to think that the assertion there is simply wrong.

> > Adding Alan to CC, since this seems to be related to the

> I am holing on the gdb session for your colleague just in case.

Thanks!  I'm sorry it's taken me so long to get back to you, it's been a
chaotic weekend.

> > minibuffer-follows-selected-frame feature.  Alan, this happens in
> > Emacs 28, so trying to fix it on the release branch in a safe way is
> > important.  TIA.

> Thanks over for so far! If the assert comes back to me, I'd just comment it
> out :-).

I think the following fix to the assert should indeed be a "safe" fix,
suitable for Emacs-28.  Could you possibly apply it, please, and try to
recreate the error.  If you don't manage to recreate the error, the bug
is probably "fixed".

diff --git a/src/window.c b/src/window.c
index 2576b66a18..35ec2a1f90 100644
--- a/src/window.c
+++ b/src/window.c
@@ -554,7 +554,9 @@ select_window (Lisp_Object window, Lisp_Object norecord,
 	 frame is active.  */
       Fselect_frame (frame, norecord);
       /* Fselect_frame called us back so we've done all the work already.  */
-      eassert (EQ (window, selected_window));
+      eassert (EQ (window, selected_window)
+	       || (EQ (window, f->minibuffer_window)
+		   && NILP (Fminibufferp (XWINDOW (window)->contents, Qt))));
       return window;
     }
   else

> Have a good day!

And yourself, too!

> Andrei

-- 
Alan Mackenzie (Nuremberg, Germany).