Sudo doesn't preserves the command line as-is
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 38/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- rust
- Área
- cli, operating-systems
Línea de trabajo
Comienza reproduciendo los dos pares de comandos en cmd.exe con sudo run --inline -- y compara la salida de GetCommandLineW(). Lee el comportamiento de la línea de comandos de CreateProcessW y las convenciones de análisis de Microsoft C Runtime a las que se hace referencia en el informe. Se considera terminado cuando los comandos inline conservan el espaciado original y las comillas incrustadas que se muestran en las salidas esperadas.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Sudo for Windows version
1.0.1
Windows build number
10.0.26100.2605
Other Software
- cmd.exe
- get-command-line or any other program that prints the literal value of
GetCommandLineW()
Steps to reproduce
Start the shell cmd.exe and run these commandlines.
1a)
C:\MeinPath\get-command-line.exe hello world
1b)
sudo run --inline -- C:\MeinPath\get-command-line.exe hello world
Replace C:\MeinPath\get-command-line.exe with path to your commandline-outputting tool.
Note the four space characters between “hello” and “world”.
2a)
C:\MeinPath\get-command-line.exe hello" "world
2b)
sudo run --inline -- C:\MeinPath\get-command-line.exe hello" "world
Expected Behavior
The expected output of command 1a) is:
C:\MeinPath\get-command-line.exe hello" "world
and of 1b):
"C:\MeinPath\get-command-line.exe" hello world
with four spaces between “hello” and “world”!
The expected output of command 2a) is:
C:\MeinPath\get-command-line.exe hello" "world
and of 2b):
"C:\MeinPath\get-command-line.exe" hello" "world
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 for CreateProcessW().
Actual Behavior
The actual behavior is, that the output of 1b) is:
"C:\MeinPath\get-command-line.exe" hello world
without four spaces between “hello” and “world”!
And the output of 2b) is actually:
"C:\MeinPath\get-command-line.exe" "hello world"
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".
- Lenguaje dominante
- Rust
- Estrellas
- 5.9k
- Forks
- 179
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/sudo
-
Invalid translation in helpAbiertoIssue-Bug Needs-Triage
Dificultad 1/5 Menos de una hora Aptitud para principiantes 74/100
-
Issue-Bug Needs-Triage
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
-
Issue-Feature Needs-Triage
Dificultad 4/5 3-5 días Aptitud para principiantes 38/100
-
Issue-Bug Needs-Triage
Dificultad 3/5 1-2 días Aptitud para principiantes 65/100
-
Issue-Bug Needs-Triage
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
Todos los issues de microsoft/sudo
Issues similares
-
XmlFragment children, successors and siblings stop at the first child that is not an XML typeAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
bug good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
repowise-dev/repowise#3374 ·
Los mantenedores suelen responder en 1 día
-
awaiting-response bug needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
wildcard/caro#1562 · 1 comentario ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
objectionary/sodg.rs#301 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
HakanSeven12/OpenCADStudio#1706 · 1 comentario ·
Los mantenedores suelen responder en 1 día