Subject: bug#58954: 28.2; ibuffer.el out of range error on lots of buffers?

From: "Chris Hecker" <[email-masked]>
Date: Tue, 01 Nov 2022 22:39:16 +0000

I was getting Args out of range: #<buffer *Ibuffer*>, 51267, 51313
when hitting C-x C-b with a ton of buffers open, lots of tramp buffers,
some eww buffers, etc.

  722 buffers    86533321   669 files, 2 processes

It's too much for me to try to repro for me right now with emacs -Q, but
hopefully this will help:

I debugged it to line 1980 in release 28.2 ibuffer.el in function
ibuffer-map-lines:

    (delete-region (line-beginning-position)
        (1+ (line-end-position)))

(line-end-position) evaluated to the end of the buffer, so 1+'ing it
made delete-region error.  Changing it to:

    (delete-region (line-beginning-position)
        (min (point-max) (1+ (line-end-position))))

made ibuffer work again.  I didn't look to closely to know if this was
the result of some logic error earlier in the function, or if this 
should have a
min guard on it normally or what.

Thanks,
Chris

In GNU Emacs 28.2 (build 2, x86_64-w64-mingw32)
  of 2022-09-13 built on AVALON
Windowing system distributor 'Microsoft Corp.', version 10.0.19044
System Description: Microsoft Windows 10 Home (v10.0.2009.19044.2130)

Configured using:
  'configure --with-modules --without-dbus --with-native-compilation
  --without-compress-install CFLAGS=-O2'

Configured features:
ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND THREADS TIFF TOOLKIT_SCROLL_BARS
XPM ZLIB

Important settings:
   value of $LANG: ENU
   locale-coding-system: cp1252

Major mode: IBuffer

Minor modes in effect:
   minibuffer-depth-indicate-mode: t
   icicle-mode: t
   which-function-mode: t
   shell-dirtrack-mode: t
   winner-mode: t
   global-eldoc-mode: t
   electric-indent-mode: t
   mouse-wheel-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
   buffer-read-only: t
   column-number-mode: t
   line-number-mode: t

Load-path shadows:
~/emacs/lisp/json hides 
c:/apps/emacs/emacs-28.2/share/emacs/28.2/lisp/json
~/emacs/lisp/css-mode hides 
c:/apps/emacs/emacs-28.2/share/emacs/28.2/lisp/textmodes/css-mode

Features:
(shadow sort emacsbug cl apropos frameset macros profiler ediff-ptch
ediff-vers po tar-mode term ehelp align arc-mode archive-mode nroff-mode
mode-local color completion find-cmd find-dired loadhist reporter gud
autoconf autoconf-mode cus-start ibuf-ext sh-script executable
pcmpl-unix novice tramp-adb tramp-archive tramp-ftp tramp-gvfs dbus
tramp-cmds rfc2104 tramp-cache make-mode edebug vc-filewise eieio-opt
speedbar ezimage dframe shortdoc cl-print debug backtrace find-func
asm-mode hl-line epa-file noutline outline calccomp calc-bin calc-alg
calc-menu help-fns radix-tree ld-script find-file js vc-annotate
filecache rng-xsd xsd-regexp rng-cmpct rng-nxml rng-valid rng-loc
rng-uri rng-parse nxml-parse rng-match rng-dt rng-util rng-pttrn nxml-ns
nxml-mode nxml-outln nxml-rap sgml-mode nxml-util nxml-enc xmltok
log-view log-edit pcvs-util smerge-mode diff vc-mtn vc-hg vc-dir ewoc
mule-util mail-extr dabbrev conf-mode bat-mode python tramp-sh vc-git
diff-mode ninja-mode jka-compr lpr vc-src vc-sccs vc-svn vc-cvs vc-rcs
vc meson-mode smie vc-bzr vc-dispatcher gnutls network-stream url-http
url-gw nsm url-cache url-auth eww xdg url-queue shr kinsoku svg xml dom
mm-url gnus nnheader misearch multi-isearch add-log cap-words superword
subword face-remap etags-select etags fileloop generator xref project
mb-depth two-column bookmark icicles icicles-mode comp comp-cstr
cl-extra icicles-cmd2 icicles-cmd1 icicles-mcmd doremi icicles-fn
icicles-var icicles-opt edmacro ffap kmacro cus-theme thingatpt
icicles-face hexrgb calc-vec calc-forms calc-misc calc-aent calc-prog
calc-ext calc calc-loaddefs rect calc-macs vcl-mode cc-langs mel-mode
prop-mode pfx-mode message rmc puny help-mode easy-mmode dired+
image-dired image-mode exif image-file image-converter dired-aux dired-x
dired dired-loaddefs rfc822 mml mml-sec epa epg rfc6068 epg-config
gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader smtpmail sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils ibuffer
ibuffer-loaddefs ediff ediff-merg ediff-mult ediff-wind ediff-diff
ediff-help ediff-init ediff-util caml-font 7z-arc-mode cperl-mode rx
facemenu fakecygpty matlab derived tempo which-func cus-edit pp wid-edit
grep cus-load cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles
cc-align cc-engine cc-vars cc-defs compile text-property-search imenu
browse-kill-ring view checker-allout checker-outline hex-util hmac-sha1
tramp tramp-loaddefs trampver tramp-integration files-x tramp-compat
shell pcomplete comint ansi-color parse-time iso8601 time-date
format-spec web-mode advice tex-site warnings server info winner ring
yaml-mode ispell finder-inf package browse-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie 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 url-vars seq
byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib iso-transl
tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel dos-w32 ls-lisp disp-table
term/w32-win w32-win w32-vars term/common-win 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 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 emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice
button loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads w32notify w32 lcms2 multi-tty
make-network-process native-compile emacs)

Memory information:
((conses 16 7324264 558950)
  (symbols 48 73599 22)
  (strings 32 391231 65833)
  (string-bytes 1 18333786)
  (vectors 16 291582)
  (vector-slots 8 6987527 568250)
  (floats 8 3204 1878)
  (intervals 56 852060 17750)
  (buffers 992 794))