From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "J.P." Newsgroups: gmane.emacs.bugs Subject: bug#62474: 29.0.60; wrong-type-argument from pcomplete-opt Date: Sun, 26 Mar 2023 19:08:00 -0700 Message-ID: <87v8int08v.fsf@neverwas.me> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9143"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: gregory@heytings.org To: 62474@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Mar 27 04:13:25 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pgcMP-00029D-04 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 27 Mar 2023 04:13:25 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pgcM5-0003e8-3N; Sun, 26 Mar 2023 22:13:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pgcM3-0003dw-VK for bug-gnu-emacs@gnu.org; Sun, 26 Mar 2023 22:13:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pgcM3-00008I-Af for bug-gnu-emacs@gnu.org; Sun, 26 Mar 2023 22:13:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pgcM2-0000m2-Lo; Sun, 26 Mar 2023 22:13:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "J.P." Original-Sender: "Debbugs-submit" Resent-CC: gregory@heytings.org, bug-gnu-emacs@gnu.org Resent-Date: Mon, 27 Mar 2023 02:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 62474 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: gregory@heytings.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16798831632947 (code B ref -1); Mon, 27 Mar 2023 02:13:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 27 Mar 2023 02:12:43 +0000 Original-Received: from localhost ([127.0.0.1]:46166 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgcLj-0000lS-2a for submit@debbugs.gnu.org; Sun, 26 Mar 2023 22:12:43 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:57840) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgcLh-0000lJ-6z for submit@debbugs.gnu.org; Sun, 26 Mar 2023 22:12:41 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pgcLg-0003cX-Sk for bug-gnu-emacs@gnu.org; Sun, 26 Mar 2023 22:12:40 -0400 Original-Received: from mail-108-mta54.mxroute.com ([136.175.108.54]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pgcLe-0008Vf-C8 for bug-gnu-emacs@gnu.org; Sun, 26 Mar 2023 22:12:40 -0400 Original-Received: from mail-111-mta2.mxroute.com ([136.175.111.2] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta54.mxroute.com (ZoneMTA) with ESMTPSA id 18720d29af2000edb4.001 for (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256); Mon, 27 Mar 2023 02:08:05 +0000 X-Zone-Loop: 685b6af496d79f2b8a9c524854a5643f056dfc52c1cd X-Originating-IP: [136.175.111.2] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=neverwas.me ; s=x; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From:Sender: Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=8RPA2WasT6aKAcsJPcGHlw4er4fPbfJBNojawEEGaIA=; b=DdoUPhD/FWaYJWCKTwUkrTu/f3 Fl3EmCJn4DmkyrUqfyzsre6NWKYusWsEazU/Wnbuip7MS/rdwm7antN5prWlId6gPvb5OOzKtx8r+ T/fw+y1IhW6BQZcqADDw5zj1fqibdD9QgGH9z08YD54Vde5+1OYExBsqMwvE1RNBzvborJYjBci00 tg3wUeF56tnK5yeKcyw5aueF6uny7SZ689nx0KRw4kV82jn23loc49Fl6zA8BHNIKQc/GYd/I+6cB 64+QQ6FK3ZegqqPWGcjRPuIPPVdATLUvybx06OCXnGIdfOpiSUrqdc3jPIJP/PWRUdlVMRUAXd7Ix PraClYcg==; X-Authenticated-Id: masked@neverwas.me Received-SPF: pass client-ip=136.175.108.54; envelope-from=jp@neverwas.me; helo=mail-108-mta54.mxroute.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:258707 Archived-At: 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))