mirror of
https://github.com/l0ng-ai/tty7.git
synced 2026-09-22 00:02:23 +00:00
`quote_for_shell` decides how a path is typed into the user's own shell, so a name that argues with the quoting is a path that names the wrong file. Posix and PowerShell had tests; cmd had none for quoting at all — only `unquote_word` and `quoting_for` — so what it does with an awkward name was written down nowhere. The `"` case is genuinely closed and the doc already said why: a Windows path cannot hold one. `%` is the open one. It is legal in a Windows filename and cmd expands `%NAME%` inside double quotes, before it parses them, so a file actually called `%USERPROFILE%.txt` pastes as a line naming somewhere else. There is no escape for it on an interactive line — `%%` is a batch-file rule and `^` is not read inside quotes — so this is pinned and documented rather than fixed, and the doc now says what it costs: the wrong path, never a command, because `%` substitutes an environment variable and can do nothing else. The rest is the coverage cmd was missing, plus a check that `is_bare` never lets a metacharacter through unquoted — which is the actual boundary, since anything bare is typed with no quoting whatsoever.