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

From: Alex <[email-masked]>
Date: Sun, 08 Oct 2017 15:19:53 -0600

Eli Zaretskii <[email-masked]> writes:

> OK, so we need to understand the path the code takes after try_window
> returns the value 1.  This means, after typing "finish" 3 times, type
> "next", then continue pressing RET until redisplay_window returns.  I
> need to see the path through the code until we exit redisplay_window
> to understand where to put the missing call to clear_glyph_matrix.

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

Old value = false
New value = true
prepare_desired_row (w=0x15cac30 <bss_sbrk_buffer+8062480>, row=0x4827bc0, mode_line_p=false) at dispnew.c:1076
1076	      row->reversed_p = rp;
(gdb) b xdisp.c:17039
Breakpoint 3 at 0x474844: file xdisp.c, line 17039.
(gdb) commands
Type commands for breakpoint(s) 3, one per line.
End with a line saying just "end".
>p w->desired_matrix->rows->enabled_p
>end
(gdb) finish
Run till exit from #0  prepare_desired_row (
    w=0x15cac30 <bss_sbrk_buffer+8062480>, row=0x4827bc0, mode_line_p=false)
    at dispnew.c:1076
display_line (it=0x7ffd11e08a20, cursor_vpos=26) at xdisp.c:21208
21208	  row->y = it->current_y;
(gdb) finish
Run till exit from #0  display_line (it=0x7ffd11e08a20, cursor_vpos=26)
    at xdisp.c:21208
0x0000000000477380 in try_window (window=..., pos=..., flags=1)
    at xdisp.c:17592
17592	      if (display_line (&it, cursor_vpos))
Value returned is $2 = true
(gdb) finish
Run till exit from #0  0x0000000000477380 in try_window (window=..., pos=..., 
    flags=1) at xdisp.c:17592
0x0000000000474866 in redisplay_window (window=..., just_this_one_p=false)
    at xdisp.c:17039
17039		  if (try_window (window, startp, TRY_WINDOW_CHECK_MARGINS) < 0)
Value returned is $3 = 1
(gdb) n
17046	      if (f->fonts_changed)
(gdb) 
17049	      if (w->cursor.vpos >= 0)
(gdb) 
17051		  if (!just_this_one_p
(gdb) 
17055		    w->base_line_number = 0;
(gdb) 
17057		  if (!cursor_row_fully_visible_p (w, true, false))
(gdb) 
17064		    goto done;
(gdb) 
17393	  SET_TEXT_POS_FROM_MARKER (startp, w->start);
(gdb) 
17394	  w->start_at_line_beg = (CHARPOS (startp) == BEGV
(gdb) 
17395				  || FETCH_BYTE (BYTEPOS (startp) - 1) == '\n');
(gdb) 
17394	  w->start_at_line_beg = (CHARPOS (startp) == BEGV
(gdb) 
17398	  if ((update_mode_line
(gdb) 
17412	      && (window_wants_mode_line (w)
(gdb) 

17416	      display_mode_lines (w);
(gdb) 
17420	      if (window_wants_mode_line (w)
(gdb) 
17421		  && CURRENT_MODE_LINE_HEIGHT (w) != DESIRED_MODE_LINE_HEIGHT (w))
(gdb) 
17431	      if (window_wants_header_line (w)
(gdb) 
17440	      if (f->fonts_changed)
(gdb) 
17444	  if (!line_number_displayed && w->base_line_pos != -1)
(gdb) 
17450	 finish_menu_bars:
(gdb) 
17454	  if (update_mode_line
(gdb) 
17455	      && EQ (FRAME_SELECTED_WINDOW (f), window))
(gdb) 
17459	      if (FRAME_WINDOW_P (f))
(gdb) 
17463		  redisplay_menu_p = FRAME_EXTERNAL_MENU_BAR (f);
(gdb) 
17471	      if (redisplay_menu_p)
(gdb) 
17472	        display_menu_bar (w);
(gdb) 
17475	      if (FRAME_WINDOW_P (f))
(gdb) 
17478		  if (FRAME_EXTERNAL_TOOL_BAR (f))
(gdb) 
17479		    redisplay_tool_bar (f);
(gdb) 
17488	      x_consider_frame_title (w->frame);
(gdb) 
17493	  if (FRAME_WINDOW_P (f)
(gdb) 
17496					    || w->pseudo_window_p)))
(gdb) 
17495					    || (!used_current_matrix_p && !overlay_arrow_seen)
(gdb) 
17494	      && update_window_fringes (w, (just_this_one_p
(gdb) 
17511	  if (WINDOW_BOTTOM_DIVIDER_WIDTH (w))
(gdb) 
17519	 need_larger_matrices:
(gdb) 
17523	   if (WINDOW_HAS_VERTICAL_SCROLL_BAR (w) || WINDOW_HAS_HORIZONTAL_SCROLL_BAR (w))
(gdb) 
17525	      if (WINDOW_HAS_VERTICAL_SCROLL_BAR (w))
(gdb) 
17527		set_vertical_scroll_bar (w);
(gdb) 
17529	      if (WINDOW_HAS_HORIZONTAL_SCROLL_BAR (w))
(gdb) 
17535	      if (FRAME_TERMINAL (f)->redeem_scroll_bar_hook)
(gdb) 
17536	        (*FRAME_TERMINAL (f)->redeem_scroll_bar_hook) (w);
(gdb) 

17542	  if (CHARPOS (opoint) < BEGV)
(gdb) 
17544	  else if (CHARPOS (opoint) > ZV)
(gdb) 
17547	    TEMP_SET_PT_BOTH (CHARPOS (opoint), BYTEPOS (opoint));
(gdb) 
17549	  set_buffer_internal_1 (old);
(gdb) 
17552	  if (CHARPOS (lpoint) <= ZV)
(gdb) 
17553	    TEMP_SET_PT_BOTH (CHARPOS (lpoint), BYTEPOS (lpoint));
(gdb) 
17555	  unbind_to (count, Qnil);
(gdb) 
17556	}
(gdb) 
redisplay_window_0 (window=...) at xdisp.c:14800
14800	  return Qnil;
(gdb) 
14801	}
(gdb) 
internal_condition_case_1 (bfun=0x46cfbf <redisplay_window_0>, arg=..., handlers=..., hfun=0x46cf87 <redisplay_window_error>) at eval.c:1357
1357	      eassert (handlerlist == c);
(gdb) 
1358	      handlerlist = c->next;
(gdb) 
1359	      return val;
(gdb) 
1361	}
(gdb) 
redisplay_windows (window=...) at xdisp.c:14784
14784	      window = w->next;
(gdb) 
14768	  while (!NILP (window))
(gdb) 
14770	      struct window *w = XWINDOW (window);
(gdb) 
14772	      if (WINDOWP (w->contents))
(gdb) 
14774	      else if (BUFFERP (w->contents))
(gdb) 
14776		  displayed_buffer = XBUFFER (w->contents);
(gdb) 
14779		  internal_condition_case_1 (redisplay_window_0, window,
(gdb) 
14784	      window = w->next;
(gdb) 
14768	  while (!NILP (window))
(gdb) 
14786	}
(gdb) 
redisplay_internal () at xdisp.c:14275
14275		      if (!FRAME_LIVE_P (f))
(gdb) 
14280		      if (gcscrollbars && FRAME_TERMINAL (f)->judge_scroll_bars_hook)
(gdb) 
14281			FRAME_TERMINAL (f)->judge_scroll_bars_hook (f);
(gdb) 
14283		      if (FRAME_VISIBLE_P (f) && !FRAME_OBSCURED_P (f))
(gdb) 
14286			  if (f->fonts_changed)
(gdb) 
14298			  if (!f->already_hscrolled_p)
(gdb) 
14300			      f->already_hscrolled_p = true;
(gdb) 
14301	                      if (hscroll_retries <= MAX_HSCROLL_RETRIES
(gdb) 
14302	                          && hscroll_windows (f->root_window))
(gdb) 
14320			  if (!f_redisplay_flag && f->redisplay)
(gdb) 
14321	                    goto retry_frame;
(gdb) 
14256		  if (FRAME_WINDOW_P (f) || FRAME_TERMCAP_P (f) || f == sf)
(gdb) 
14260			= f->redisplay || !REDISPLAY_SOME_P ();
(gdb) 
14258		      bool gcscrollbars
(gdb) 
14261		      bool f_redisplay_flag = f->redisplay;
(gdb) 
14264		      if (gcscrollbars && FRAME_TERMINAL (f)->condemn_scroll_bars_hook)
(gdb) 
14265			FRAME_TERMINAL (f)->condemn_scroll_bars_hook (f);
(gdb) 
14267		      if (FRAME_VISIBLE_P (f) && !FRAME_OBSCURED_P (f))
(gdb) 
14268			redisplay_windows (FRAME_ROOT_WINDOW (f));
(gdb) 

Thread 1 "emacs" hit Breakpoint 3, redisplay_window (window=..., just_this_one_p=false) at xdisp.c:17039
17039		  if (try_window (window, startp, TRY_WINDOW_CHECK_MARGINS) < 0)
$4 = true
(gdb) 

Thread 1 "emacs" received signal SIGABRT, Aborted.
raise (sig=6) at ../sysdeps/unix/sysv/linux/raise.c:51

>> Have you tried using MELPA[1] to install magit? Maybe that would
>> work.
>
> I'm not sure how will this help.  I don't want to install Magit, I
> just use it from a directory where I unzipped its snapshot.  How using
> MELPA would change that?

I'm not sure how either; MELPA was just on my mind since that's how I'm
using Magit's dependencies.