Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
_path_files mishandles backslash words: inserts \*, or offers nothing
- X-seq: zsh-workers 55155
- From: "Tom Hale" <tom@xxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: _path_files mishandles backslash words: inserts \*, or offers nothing
- Date: Mon, 14 Sep 2026 14:11:40 +0700
- Archived-at: <https://zsh.org/workers/55155>
- Feedback-id: i11d040b0:Fastmail
- List-id: <zsh-workers.zsh.org>
Environment: zsh 5.9.2 (x86_64-pc-linux-gnu), zsh -f, no plugins (-f / --norcs)
Reproduction:
mkdir /tmp/bs && cd /tmp/bs
touch 'has\one' 'has\\two'
zsh -f
autoload -Uz compinit; compinit -u
(a) Type cat has\\o<TAB>. (b) Type cat has\\<TAB> (bare, word ends in the two backslashes).
Expected: (a) the word unquotes to literal has\o, uniquely prefixing has\one, which should be offered — the glob layer is fine (echo has\\* expands to both files; print -r -l has\\o* prints has\one). (b) both files listed, or unambiguous has\ inserted.
Observed: (a) each TAB bells only: no match, no listing, buffer unchanged. (b) buffer becomes cat has\\\* (note literal '*') plus a bell — a word matching nothing.
I could vibe up PR if that would help speed things along -- let me know. Here are (maybe) some pointers:
Analysis (functions -T _path_files): (a) compfiles -p tmp1 accex '' ' ' '' fake '*' returns empty, [[ -e 'has\o' ]] is false, continue 2 — the literal-prefix glob is never attempted. (b) the same call yields the pattern itself, tmp1=( 'has\*' ), with no further assignment before compadd -Qf -a tmp1; the single "match" is then inserted verbatim as has\\\*.
--
Tom Hale
Messages sorted by:
Reverse Date,
Date,
Thread,
Author