Sudo doesn't preserves the command line as-is #117
Labels
Issue-Bug
Something isn't working
Needs-Triage
It's a new issue that the core contributor team needs to triage at the next triage meeting
Sudo for Windows version
1.0.1
Windows build number
10.0.26100.2605
Other Software
GetCommandLineW()
Steps to reproduce
Start the shell
cmd.exe
and run these commandlines.1a)
1b)
Replace
C:\MeinPath\get-command-line.exe
with path to your commandline-outputting tool.Note the four space characters between “hello” and “world”.
2a)
2b)
Expected Behavior
The expected output of command 1a) is:
and of 1b):
with four spaces between “hello” and “world”!
The expected output of command 2a) is:
and of 2b):
with the quote characters inbetween “hello” and “world”.
cmd preserves the command-line with all spaces, which was entered by the user, when it builds the
lpCommandLine
argument forCreateProcessW()
.Actual Behavior
The actual behavior is, that the output of 1b) is:
without four spaces between “hello” and “world”!
And the output of 2b) is actually:
with the quote characters around “hello world”.
See this image:
Comments
The reason that I report this bug, is, that not every program on Windows uses the same logic to split commandline into multiple arguments.
The usual convetion is to do it like the Microsoft C-Runtime. But some programs like
cmd.exe
itself, do it differently.If the commandline after the two dashes
--
is preserved as-is, it would be the best, I think.Another helpful program to debug these things is my Rust program "create-process-rust".
The text was updated successfully, but these errors were encountered: