Subject: bug#56561: 29.0.50; Infloop in try_window

From: Michael Welsh Duggan <[email-masked]>
Date: Thu, 14 Jul 2022 14:57:40 -0400

No recipe for this.  In the course of using Emacs, I ended up in an
infloop in `try_window`.

I've connected to this in gdb.  `try_window' is calling `display_line'
in a loop until the iterator hits a certain point.  But `display_line',
in this case, isn't modifying the iterator, so the loop never ends.
Here follows part of the debugging session demonstrating this.  I'll
keep this gdb session alive for a while.

try_window (window=window@entry=XIL(0x55555b4301f5), pos=..., flags=flags@entry=2) at ../../md5i/src/xdisp.c:20208
20208         if (f->fonts_changed && !(flags & TRY_WINDOW_IGNORE_FONTS_CHANGE))
(gdb) n
20204     while (it.current_y < it.last_visible_y)
(gdb) p it.current_y
$11 = 595
(gdb) p it.last_visible_y
$12 = 680
(gdb) n
20206         if (display_line (&it, cursor_vpos))
(gdb) s
display_line (it=it@entry=0x7fffffffb770, cursor_vpos=cursor_vpos@entry=0) at ../../md5i/src/xdisp.c:24140
24140   {
(gdb) n
24141     struct glyph_row *row = it->glyph_row;
(gdb) 
24154     ptrdiff_t min_pos = ZV + 1, max_pos = 0;
(gdb) 
24157     int tab_line = window_wants_tab_line (it->w);
(gdb) 
24158     int header_line = window_wants_header_line (it->w);
(gdb) 
24159     bool hscroll_this_line = (cursor_vpos >= 0
(gdb) 
24162     int first_visible_x = it->first_visible_x;
(gdb) 
24163     int last_visible_x = it->last_visible_x;
(gdb) 
24169     if (MATRIX_ROW_VPOS (row, it->w->desired_matrix)
(gdb) 
24172         it->w->nrows_scale_factor++;
(gdb) p it->w->nrows_scale_factor
$13 = 2064109537
(gdb) n
24173         it->f->fonts_changed = true;
(gdb) 
24174         return false;
(gdb) 
try_window (window=window@entry=XIL(0x55555b4301f5), pos=..., flags=flags@entry=2) at ../../md5i/src/xdisp.c:20208
20208         if (f->fonts_changed && !(flags & TRY_WINDOW_IGNORE_FONTS_CHANGE))
(gdb) 
20204     while (it.current_y < it.last_visible_y)

In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0)
 of 2022-07-03 built on miko
Repository revision: e41ba8ab89a125c91dee672845679f2dec19853a
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Debian GNU/Linux bookworm/sid

Configured using:
 'configure --without-toolkit-scroll-bars --with-x-toolkit=lucid
 --with-native-compilation --with-xinput2 'CFLAGS=-Og -ggdb''

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON
LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP
NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF X11
XAW3D XDBE XIM XINPUT2 XPM LUCID ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  flyspell-mode: t
  display-time-mode: t
  magit-wip-initial-backup-mode: t
  magit-wip-before-change-mode: t
  magit-wip-after-apply-mode: t
  magit-wip-after-save-mode: t
  magit-wip-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  shell-dirtrack-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  line-number-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/md5i/.config/emacs/elpa/transient-20220514.945/transient hides /home/md5i/src/emacs/md5i/lisp/transient

Features:
(shadow sort mail-extr gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime
smime gnutls dig gnus-sum shr pixel-fill kinsoku url-file url-dired svg
gnus-group gnus-undo gnus-start gnus-dbus gnus-cloud gnus-spec gnus-win
emacsbug goto-addr bug-reference thingatpt mule-util face-remap
dired-aux flyspell ispell view pacproxy descr-text tramp tramp-loaddefs
trampver tramp-integration cus-edit pp cus-load files-x tramp-compat
parse-time iso8601 ls-lisp time sieve-manage sasl sasl-anonymous
sasl-login sasl-plain rng-loc rng-uri rng-parse rng-match rng-dt
rng-util rng-pttrn nxml-parse nxml-ns nxml-enc xmltok nxml-util
sgml-mode facemenu dom python ps-print ps-print-loaddefs ps-def lpr
picture nm dbus xml magit-submodule magit-obsolete magit-blame
magit-stash magit-reflog magit-bisect magit-push magit-pull magit-fetch
magit-clone magit-remote magit-commit magit-sequence magit-notes
magit-worktree magit-tag magit-merge magit-branch magit-reset
magit-files magit-refs magit-status magit magit-repos magit-apply
magit-wip magit-log which-func imenu magit-diff smerge-mode diff
diff-mode easy-mmode git-commit log-edit pcvs-util add-log magit-core
magit-autorevert autorevert filenotify magit-margin magit-transient
magit-process with-editor shell pcomplete server magit-mode transient
comp comp-cstr warnings rx cl-extra edmacro kmacro help-mode magit-git
magit-base magit-section format-spec crm dash compat-27 compat-26 compat
nnimap nnmail gnus-int mail-source gnus-range message sendmail
yank-media rfc822 mml mml-sec epa mm-decode mm-bodies mm-encode
mailabbrev gmm-utils mailheader utf7 netrc nnoo gnus wid-edit nnheader
gnus-util time-date mail-utils range gnus-o365-oauth2 oauth2 url-http
url-auth mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums
mail-prsvr url-gw nsm puny plstore generated generic-x epg rfc6068
epg-config ediff ediff-merg ediff-mult ediff-wind ediff-diff ediff-help
ediff-init ediff-util dired-x dired dired-loaddefs compile
text-property-search comint ring ansi-color cc-mode cc-fonts cc-guess
cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs derived
debian-el rainbow-delimiters-autoloads info package browse-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache json subr-x map byte-opt gv bytecomp byte-compile cconv
url-vars cl-loaddefs cl-lib rmc iso-transl tooltip eldoc paren electric
uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
faces cus-face macroexp files window text-properties overlay sha1 md5
base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo x-toolkit
xinput2 x multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 380223 18419)
 (symbols 48 27063 2)
 (strings 32 95513 5733)
 (string-bytes 1 3154480)
 (vectors 16 56391)
 (vector-slots 8 955380 21517)
 (floats 8 665 186)
 (intervals 56 3263 950)
 (buffers 992 18))

-- 
Michael Welsh Duggan
([email-masked])