Subject: bug#52169: 28.0.60; "Args out of range" when completing shell command

From: Lars Ingebrigtsen <[email-masked]>
Date: Mon, 29 Nov 2021 16:26:05 +0100

Kévin Le Gouguec <[email-masked]> writes:

> $ emacs -Q
> M-! ./nosuchcommand C-b TAB
>
> - In Emacs 27.1, this simply says "[No match]".
> - In Emacs 28.0.60, this errors out:
>
>> completion--some: Args out of range: "./nosuchcomma", 0, 14

As far as I can tell, this comes from:

(defun completion-basic-try-completion (string table pred point)

[...]

      (let* ((suffix (substring afterpoint (cdr bounds)))
             (prefix (substring beforepoint 0 (car bounds)))

But the length of beforepoint (i.e., "./nosuchcomma") is 13, while (car
bounds) is 14.

I'm not sure how this all connects up, so I've added Stefan to the CCs.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no