Subject: Re: bug#28710: 27.0.50; eassert failure in maybe_produce_line_number

From: Alex <[email-masked]>
Date: Sat, 07 Oct 2017 17:05:34 -0600

Eli Zaretskii <[email-masked]> writes:

> I wrote instructions for a debugging session to find that out, see
>
>   https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27668#89
>
> Instead of "r -Q", type just "run" to run Emacs as usual, or even
> attach to an already running Emacs with "gdb -p", set the breakpoint,
> and type "continue.  The "Inside Emacs" part will have to be replaced
> with your recipe, up to and including step 5, and you should invoke
> redraw-display just before hitting the final RET in step 6, the one
> that triggers the assertion.  After performing the GDB commands and
> continuing Emacs, hit RET, and post the backtraces from every time the
> watchpoint set by those GDB commands is hit.  I hope we will then see
> the offending code that needs to be fixed.
>
> Let me know if you need me to rewrite the instructions to fit your
> case exactly.

Okay, I've pasted the output below. 2 watchpoints triggered right after
M-x redraw-display, and I only get the third before the assertion.

After your recipe, you mention update_display and how it runs after
Emacs "redrawn the window to the glass", so it should be noted that the
assertion violated is triggered before the buffer with
display-line-numbers is displayed.

Thread 1 "emacs" hit Hardware watchpoint 4: -location $1->desired_matrix->rows->enabled_p

Old value = false
New value = true
prepare_desired_row (w=0x45066d0, row=0x4509fa0, mode_line_p=true) at dispnew.c:1076
1076	      row->reversed_p = rp;
(gdb) 
Lisp Backtrace:
"redisplay_internal (C function)" (0x0)

Thread 1 "emacs" hit Hardware watchpoint 4: -location $1->desired_matrix->rows->enabled_p

Old value = true
New value = false
clear_glyph_matrix_rows (matrix=0x38d2a30, start=0, end=37) at dispnew.c:693
693	  for (; start < end; ++start)

Lisp Backtrace:
"redisplay_internal (C function)" (0x0)

Thread 1 "emacs" hit Hardware watchpoint 4: -location $1->desired_matrix->rows->enabled_p

Old value = false
New value = true
prepare_desired_row (w=0x45066d0, row=0x4509fa0, mode_line_p=false) at dispnew.c:1076
1076	      row->reversed_p = rp;

Lisp Backtrace:
"redisplay_internal (C function)" (0x0)

Thread 1 "emacs" hit Breakpoint 1, terminate_due_to_signal (sig=6, backtrace_limit=2147483647) at emacs.c:364
364	  signal (sig, SIG_DFL);

>> That's odd, since I believe unless there was a git error the first line
>> should start with "Head:" and pressing RET on it shows the commit at
>> HEAD. Maybe there's another situation where that's not the case.
>
> What if HEAD is a merge-commit?  I think this is what I got when I
> tried.  Anyway, this is just a tangential issue.

I believe it should still show the "Head:" line, but there's no hunks
that are displayed in the revision buffer. I tried reproducing by
pressing RET on a filename in its revision buffer and it also crashes.

>> Just to specify a commit, try M-x magit-show-commit RET 92045f45 RET in
>> an Emacs repo and press RET on the following line:
>> +@code{file-symlink-p}, @code{file-system-info}
>
> You mean "C-u M-x magit-show-commit", right?  Tried this as well,
> still no assertion violation.

If you want to force a completing-read for the commit, then yes. Too bad
you still can't reproduce it; every build I've configured with
"--enable-checking=yes,glyphs --enable-check-lisp-object-type
'CFLAGS=-O0 -g3'" crashes here.

> P.S. Btw, I'm debugging this in the emacs-26 branch, so perhaps so
> should you, to avoid any irrelevant differences between what you and I
> see.  I tried reproducing the assertion violation in both branches,
> and failed in both.

Okay, the debugging done above is with an up-to-date emacs-26
branch.