bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#62474: 29.0.60; wrong-type-argument from pcomplete-opt


From: J.P.
Subject: bug#62474: 29.0.60; wrong-type-argument from pcomplete-opt
Date: Sun, 26 Mar 2023 19:08:00 -0700
User-agent: Gnus/5.13 (Gnus v5.13)

Hi, this may be related to (or a duplicate of):

  https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59750

I first encountered it in ERC, but it appears to happen from any
pcomplete/foo function that calls `pcomplete-opt' with a string of
length two or more. AFAICT, this doesn't occur in Emacs 28.

Example from emacs -Q:

  1. M-x eshell
  2. type "gzip -" and hit TAB
  3. type "h" -> wrong-type-argument // "h" gets inserted anyway
  4. type TAB -> wrong-type-argument

  ~/emacs/emacs-29 gzip -{h}
  Error in post-command-hook (completion-in-region--postch):
  (wrong-type-argument integer-or-marker-p nil)
  
  ~/emacs/emacs-29 gzip -h{tab}
  Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
    pcomplete-arg()
    pcomplete-opt("cdfhlLnNqrStvV123456789")
    pcomplete/gzip()
    pcomplete-completions()
    pcomplete-completions-at-point()
    completion--capf-wrapper(pcomplete-completions-at-point all)
    run-hook-wrapped(completion--capf-wrapper pcomplete-completions-at-point 
all)
    completion-at-point()
    funcall-interactively(completion-at-point)
    call-interactively(completion-at-point nil nil)
    command-execute(completion-at-point)

The backtrace for `pcomplete/erc-mode/DCC' is basically identical to the
one above. But stepping through it manually reveals:

  (buffer-substring (pcomplete-begin index offset) (point))
  pcomplete-actual-arg(nil nil)
  (split-string (pcomplete-actual-arg index offset))
  (car (split-string (pcomplete-actual-arg index offset)))
  (propertize (car (split-string (pcomplete-actual-arg index offset))) 
'pcomplete-arg-value arg)
  (if (or (stringp arg) (eq index 'last)) arg (...))
  (let ((arg (nth (+ (let* ((val index)) (...)) (or offset 0)) 
pcomplete-args))) (...))
  pcomplete-arg()
  (setq pcomplete-stub (pcomplete-arg))
  (progn (setq pcomplete-index (1+ pcomplete-index)) (setq pcomplete-stub 
(pcomplete-arg)))
  pcomplete-next-arg()
  (progn (pcomplete-next-arg) ...)
  (if (and (> (length arg) 1) (stringp arg) (eq (aref arg 0) (or prefix 45))) 
(...))
  (let ((arg (pcomplete-arg))) (...))
  (if (and (= pcomplete-index pcomplete-last) (string= (pcomplete-arg) "-")) 
(...))
  pcomplete-opt("ts")
  pcomplete/erc-mode/DCC()
  pcomplete-completions()
  pcomplete-completions-at-point()
  erc-pcompletions-at-point()
  run-hook-with-args-until-success(erc-pcompletions-at-point)
  erc-complete-word-at-point()
  completion--capf-wrapper(erc-complete-word-at-point all)
  run-hook-wrapped(completion--capf-wrapper erc-complete-word-at-point all)
  completion-at-point()
  funcall-interactively(completion-at-point)
  call-interactively(completion-at-point nil nil)
  command-execute(completion-at-point)

I don't know enough about pcomplete to have an opinion here, but I did
notice two quite similar out-of-range `nth' accesses, which may be
unrelated or useless:

  1. In `pcomplete-arg', `pcomplete-index' equals the length of
     `pcomplete-args', resulting in `nth' always returning nil.

  2. In the offending pcomplete-begin(nil nil) -> nil, `index' becomes 3
     (courtesy of `pcomplete-index'), which is also the length of
     `pcomplete-begins'.

I've copied in Gregory Heytings, who has relatively recent commits
in this general vicinity. Thanks.


In GNU Emacs 29.0.60 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.35, cairo version 1.17.6) of 2023-03-26 built on localhost

Configured using:
 'configure --enable-check-lisp-object-type --enable-checking=yes,glyphs
 'CFLAGS=-O0 -g3'
 PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'

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

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-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
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search time-date subr-x 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 rmc iso-transl tooltip cconv 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
theme-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
move-toolbar gtk x-toolkit xinput2 x multi-tty make-network-process
emacs)

Memory information:
((conses 16 36151 10267)
 (symbols 48 5152 0)
 (strings 32 13131 2059)
 (string-bytes 1 374002)
 (vectors 16 9322)
 (vector-slots 8 148973 14280)
 (floats 8 21 26)
 (intervals 56 220 0)
 (buffers 976 10))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]