Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [BUG] incorrect expansion with expand-or-complete and single quote
- X-seq: zsh-workers 53794
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: [BUG] incorrect expansion with expand-or-complete and single quote
- Date: Fri, 20 Jun 2025 08:56:04 -0700
- Archived-at: <https://zsh.org/workers/53794>
- In-reply-to: <20250620011321.GA157414@qaa.vinc17.org>
- List-id: <zsh-workers.zsh.org>
- References: <20250620011321.GA157414@qaa.vinc17.org>
On Thu, Jun 19, 2025 at 6:13 PM Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
>
> I recall the following bug I posted in workers/53040 (with a
> small correction in workers/53041) concerning expansion with
> expand-or-complete and single quote.
>
> Nothing has changed in 5.9.0.2-test.
Single quotes have always been a problem for compsys, because the
low-level code that implements comparisons has to preserve
tokenization of the quoted parts of the word from the command line
while also un-tokenizing the parts that should be interpreted as
patterns, then rebuild the whole thing in a form that can be passed to
the shell-level functions that actually do the work, and then reverse
all this again after compadd before putting the results back on the
command line or into a completion list.
It does this in part by converting the word from whatever quoting
actually appears on the command line to use a consistent form
throughout, but that means some details are lost. This turns out to
be worst when single quotes are protected by backslashes instead of
being enclosed in double-quotes.
I don't think this can be fixed purely at the current shell code
level, and fixing it in the C code deep and early in the compsys flow
is not only difficult but would likely force cascading changes through
many of the existing shell functions. File names and other words
containing single quotes are just not a very common completion case,
and unless we get a volunteer to develop a Sven W. depth of
understanding of the completion internals, are likely to remain a
broken case.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author