* bug#62474: 29.0.60; wrong-type-argument from pcomplete-opt
@ 2023-03-27 2:08 J.P.
2024-01-18 23:18 ` J.P.
0 siblings, 1 reply; 2+ messages in thread
From: J.P. @ 2023-03-27 2:08 UTC (permalink / raw)
To: 62474; +Cc: gregory
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))
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#62474: 29.0.60; wrong-type-argument from pcomplete-opt
2023-03-27 2:08 bug#62474: 29.0.60; wrong-type-argument from pcomplete-opt J.P.
@ 2024-01-18 23:18 ` J.P.
0 siblings, 0 replies; 2+ messages in thread
From: J.P. @ 2024-01-18 23:18 UTC (permalink / raw)
To: 62474-done
"J.P." <jp@neverwas.me> writes:
> 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
This appears to have been fixed by
239db5d5162f6f9a4a6735e176c8d306f18e50e7
Author: Jim Porter <jporterbugs@gmail.com>
AuthorDate: Tue Sep 5 18:27:21 2023 -0700
Commit: Jim Porter <jporterbugs@gmail.com>
CommitDate: Tue Oct 10 13:00:38 2023 -0700
Follows: emacs-29.1 (168549)
Revert commits dafa6d6badd6 and 72c45fa9109a
These were there to work around deficiencies in how Eshell produces
completions for 'pcomplete-argument' (Eshell passed various non-string
objects to Pcomplete, which broke things). Now, Eshell always returns
a stringified form of the argument, with the original value stored via
the text property 'pcomplete-arg-value'.
* lisp/pcomplete.el (pcomplete-arg): Revert changes back to a simpler
form.
1 file changed, 7 insertions(+), 29 deletions(-)
lisp/pcomplete.el | 36 +++++++-----------------------------
Closing.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-01-18 23:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-27 2:08 bug#62474: 29.0.60; wrong-type-argument from pcomplete-opt J.P.
2024-01-18 23:18 ` J.P.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).