Subject: bug#32523: 27.0.50; Emacs hangs when killing rectangle

From: Joseph Mingrone <[email-masked]>
Date: Fri, 24 Aug 2018 21:59:48 -0300

Here is a recipe to make Emacs (nearly) hang indefinitely.

1. emacs -Q

2. Visit the file found https://ftfl.ca/misc/big_file_hangs_emacs.txt

3. M-x toggle-truncate-lines

4. Use rectangle-mark-mode (C-x SPC) to mark the rectangle that starts
   at the top left of the file (point 1), and includes the leading white
   space, the line numbers, and the space after the line numbers (point
   468848).

5. Kill the rectangle with C-x r k.

For me, the Emacs process will continue to use 100% CPU and Emacs is
almost completely unresponsive and has to be killed.  Some actions such
as saving the file may complete, but only after a few minutes.

This is with a recent commit (eb787d7) on the master branch.

In GNU Emacs 27.0.50 (build 1, amd64-portbld-freebsd11.2, GTK+ Version 3.22.29)
Windowing system distributor 'The X.Org Foundation', version 11.0.11804000
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Configured using:
 'configure --disable-build-details --localstatedir=/var
 --with-gameuser=games:games --without-libsystemd --without-mini-gmp
 --with-wide-int=no --with-x --enable-acl --without-dbus --without-gconf
 --with-gnutls --without-gsettings --with-json --with-lcms2
 --with-m17n-flt --with-mailutils --with-modules --with-libotf
 --with-toolkit-scroll-bars --with-threads --with-xft --with-xim
 --with-xml2 --without-xwidgets --with-file-notification=kqueue
 --with-sound=oss --with-x-toolkit=gtk3 --without-cairo --with-gif
 --with-jpeg --with-imagemagick --with-png --with-rsvg --with-tiff
 --with-xpm --x-libraries=/usr/local/lib --x-includes=/usr/local/include
 --prefix=/usr/local --mandir=/usr/local/man --disable-silent-rules
 --infodir=/usr/local/share/emacs/info/
 --build=amd64-portbld-freebsd11.2 'CFLAGS=-O2 -pipe -fstack-protector
 -isystem /usr/local/include -fno-strict-aliasing' 'CPPFLAGS=-isystem
 /usr/local/include' 'LDFLAGS= -fstack-protector -L/usr/local/lib''

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND NOTIFY ACL GNUTLS LIBXML2
FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 MODULES
THREADS JSON LCMS2 GMP

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

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv
bytecomp byte-compile cconv dired dired-loaddefs format-spec rfc822 mml
easymenu mml-sec password-cache epa derived epg epg-config gnus-util
rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils elec-pair time-date
mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type 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 elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic 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 charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads kqueue lcms2
dynamic-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 94849 6162)
 (symbols 48 20212 1)
 (strings 32 28576 1649)
 (string-bytes 1 752582)
 (vectors 16 14291)
 (vector-slots 8 505822 8998)
 (floats 8 47 70)
 (intervals 56 253 0)
 (buffers 992 11))