Repository navigation
Quote "$@" in bash no-config wrapper so arguments with spaces survive - #1147
Open
TEJA P C (PCTEJA) wants to merge 1 commit into
Open
TEJA P C (PCTEJA) wants to merge 1 commit into
TEJA P C (PCTEJA) wants to merge 1 commit into
Conversation
The bundled bash wrapper forwarded unquoted $@, so an argument containing a space was split into multiple arguments before reaching the debug target (e.g. "hello world" arrived as 'hello' and 'world'). Use "$@" so each argument is forwarded exactly as given, including arguments containing spaces and the zero-argument case. Fixes microsoft#820
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #820.
The bundled bash no-config wrapper
bundled/scripts/noConfigScripts/debugpyforwarded unquoted$@, so arguments containing spaces were split before reaching the debug target:Change
One line: forward
"$@"instead of$@, so each argument is passed exactly as given. With zero arguments,"$@"correctly expands to no words.Deliberately out of scope: quoting
$BUNDLED_DEBUGPY_PATHon the same line. That changes behaviour when the variable is unset/empty (an empty-string argument would be passed to python3 instead of no argument), so it deserves separate handling with an explicit check rather than being bundled into this fix.Testing
Reproduced and verified with bash using a stub adapter that prints
sys.argv:["--listen", "0", "--wait-for-client", "/path/to/script.py", "hi", "hello", "world"]["--listen", "0", "--wait-for-client", "/path/to/script.py", "hi", "hello world"]["--listen", "0", "--wait-for-client"]The patch was also independently reviewed with Codex (GPT-6 Astra), which re-ran the reproduction plus edge cases (empty argument, tabs/newlines in arguments, wildcards, quotes, backslashes) — all passing — and recommended the narrowed
"$@"-only scope described above.This change was prepared with AI assistance (Muse, validated with Codex); I have reviewed every changed line and take responsibility for it.