Skip to content

Strip quotes from /system arguments on Windows - #2465

Merged
rolandwalker merged 1 commit into
dbcli:mainfrom
goranai:fix/system-windows-quoted-args
Nov 23, 2026
Merged

rolandwalker merged 1 commit into
dbcli:mainfrom
goranai:fix/system-windows-quoted-args

Conversation

@goranai

@goranai goranai commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Description

On Windows, /system kept the quote characters in each quoted argument, because shlex.split(..., posix=False) does not remove them. So /system cd "my dir" failed with "The filename, directory name, or volume label syntax is incorrect", and /system python -c "print(12)" ran a string literal and printed nothing.

This drops one pair of matching surrounding quotes (single or double) from each token when WIN is true. It is the same rule /source already uses for its filename. POSIX is unchanged.

Behavior change: on Windows a single-quoted token such as 'Write-Output 7' now loses its quotes. Before, the program received the quotes as text and printed Write-Output 7 instead of running it.

Not changed: a quote in the middle of a word, such as --opt="a b", is still split by non-POSIX shlex, same as before.

Checks I ran on Windows 11, Python 3.14.7, on top of main 762f107:

  • test_special_io_commands.py: 226 passed, 18 skipped. The 4 new test cases fail without the fix.
  • Whole suite with test_special_llm.py ignored: 86 failed, 3435 passed. The same 86 fail on main (POSIX-only tests on Windows), and main has 3430 passed.
  • ruff check ., ruff format --check . and mypy --platform linux on the changed file are clean.
  • Real runs: cd "tmp dir" and cd 'tmp dir' change directory. python -c "print(12)" prints 12. powershell -Command "Write-Output 8" prints 8.
  • Fuzz with 60000 rendered argument lists (spaces, tabs, empty strings, unicode, Windows paths with backslashes, CRLF, quotes inside the other quote): 0 inputs that worked before and fail now. 53458 that failed before now work.

Fixes #2464

Validated with Claude Opus 5.5.

Checklist

  • I added this contribution to the changelog.md file.
  • I added my name to the mycli/AUTHORS.txt file (or it's already there).
  • To lint and format the code, I ran
    uv run ruff check && uv run ruff format && uv run mypy --install-types .
    (ruff check, ruff format --check and mypy were run with a pip venv, not uv)

@rolandwalker rolandwalker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@rolandwalker
rolandwalker merged commit aad4da5 into dbcli:main Nov 23, 2026
13 checks passed
@rolandwalker

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

On Windows, /system keeps the quote characters in quoted arguments

2 participants