From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#52169: 28.0.60; "Args out of range" when completing shell command Date: Sun, 05 Dec 2021 23:24:13 -0500 Message-ID: References: <87wnksx8oc.fsf@gmail.com> <87wnkrvv8y.fsf@gnus.org> <87czmcguil.fsf@gmail.com> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3275"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 52169@debbugs.gnu.org, =?UTF-8?Q?K=C3=A9vin?= Le Gouguec To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 06 05:25:10 2021 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 1mu5Ys-0000dJ-4b for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 06 Dec 2021 05:25:10 +0100 Original-Received: from localhost ([::1]:37098 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mu5Yq-0006jj-Uq for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 05 Dec 2021 23:25:08 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:55636) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mu5Yj-0006ja-W5 for bug-gnu-emacs@gnu.org; Sun, 05 Dec 2021 23:25:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48668) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mu5Yj-0002Uk-OB for bug-gnu-emacs@gnu.org; Sun, 05 Dec 2021 23:25:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mu5Yj-0004CB-Jr for bug-gnu-emacs@gnu.org; Sun, 05 Dec 2021 23:25:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 06 Dec 2021 04:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52169 X-GNU-PR-Package: emacs Original-Received: via spool by 52169-submit@debbugs.gnu.org id=B52169.163876467216078 (code B ref 52169); Mon, 06 Dec 2021 04:25:01 +0000 Original-Received: (at 52169) by debbugs.gnu.org; 6 Dec 2021 04:24:32 +0000 Original-Received: from localhost ([127.0.0.1]:60214 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mu5YG-0004BF-0z for submit@debbugs.gnu.org; Sun, 05 Dec 2021 23:24:32 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:62870) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mu5YB-0004B0-V5 for 52169@debbugs.gnu.org; Sun, 05 Dec 2021 23:24:30 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id A98B980558; Sun, 5 Dec 2021 23:24:21 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 514E28051E; Sun, 5 Dec 2021 23:24:20 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1638764660; bh=KG5+64nEUh27FSNvcCMJDy3/5rvA8wscd37RT9L5Mk4=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=VidRoWdU0cy5MYIiNae9Fm34cytGRJXQV7xAuDccYIL1ZmKt744B1M2lbuQPKyAFm IxUWKCc4I9tbOpT9P3vIi3oFdpAybocO9GMk1A6ge0I9fcUjkD5Pdz42EV5EXDK1fL XyuFi9ExXJsC2qSYRM/Pwv86W0PILuqqc3jbtbFmFsDOIp6zhHnkdXTjdcUfxNMBsq JajR+1AcoXqgAuSWAQbQ6Ec53cbVGlvxBAfp668ey/1wdQLs0xcnZXRIy9cgvqW3ME x9gGNWuVrAOHZP0nFSCWZScrCmjV9vItjeX9ixDZxzXD1gaoND5w1HTMvAaeieawyH WjNcUbBC0t+Cg== Original-Received: from pastel (unknown [216.154.30.173]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 1BB1B120BB1; Sun, 5 Dec 2021 23:24:20 -0500 (EST) In-Reply-To: <87czmcguil.fsf@gmail.com> ("=?UTF-8?Q?K=C3=A9vin?= Le Gouguec"'s message of "Sat, 04 Dec 2021 18:16:50 +0100") 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" Xref: news.gmane.io gmane.emacs.bugs:221707 Archived-At: K=E9vin Le Gouguec [2021-12-04 18:16:50] wrote: > Stefan Monnier writes: >> I pushed to `master` a fix for the immediate cause of the `Args out of >> range` error, which seems to brings us back to Emacs-27's poor behavior. > Can confirm, thanks! Thanks. >> Maybe it's good enough for `emacs-28` as well, but I have to think about >> this problem a bit more. > OK; leaving this open for the time being then. Hmm, I can't think of a good way to make it work correctly without significant changes to `pcomplete.el` and its API. For `emacs-28`, I propose the patch below, which is a slightly improved version of the patch currently on `master`. As before, it won't fix the real problem, but will avoid "Args out of range" and revert to the behavior we had in Emacs-27 (which was/is broken, but tends to be milder for the user). Any objection? Stefan diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index ca82b4a9e60..21d610fdf44 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -283,8 +283,9 @@ completion-table-subvert ((eq (car-safe action) 'boundaries) (let ((beg (or (and (eq (car-safe res) 'boundaries) (cadr res)) = 0))) `(boundaries - ,(max (length s1) - (+ beg (- (length s1) (length s2)))) + ,(min (length string) + (max (length s1) + (+ beg (- (length s1) (length s2))))) . ,(and (eq (car-safe res) 'boundaries) (cddr res))))) ((stringp res) (if (string-prefix-p s2 res completion-ignore-case)