Sudo doesn't preserves the command line as-is
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 38/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Stack technique
- rust
- Domaine
- cli, operating-systems
Piste de recherche
Commencez par reproduire les deux paires de commandes dans cmd.exe avec sudo run --inline -- et comparez la sortie de GetCommandLineW(). Lisez le comportement de la ligne de commande de CreateProcessW et les conventions d’analyse de Microsoft C Runtime citées dans le rapport. Le travail est terminé lorsque les commandes inline préservent l’espacement d’origine et les guillemets intégrés indiqués dans les sorties attendues.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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".
- Langage dominant
- Rust
- Étoiles
- 5.9k
- Forks
- 180
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de microsoft/sudo
-
Invalid translation in helpOuverteIssue-Bug Needs-Triage
Difficulté 1/5 Moins d'une heure Accessibilité débutants 74/100
-
Feature request: return the final console contents after a command runs in a new elevated windowOuverteIssue-Feature Needs-Triage
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 35/100
-
Issue-Bug Needs-Triage
Difficulté 3/5 1-2 jours Accessibilité débutants 55/100
-
Issue-Feature Needs-Triage
Difficulté 4/5 3-5 jours Accessibilité débutants 38/100
-
Issue-Bug Needs-Triage
Difficulté 3/5 1-2 jours Accessibilité débutants 65/100
Toutes les issues de microsoft/sudo
Issues similaires
-
area/tools bug session-analysis
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 80/100
oracle/rust-oracledb#66 ·
-
p3 testing
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
respanai/respan-gateway#166 ·
Les mainteneurs répondent en général sous 1 jour
-
fixes
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
astral-sh/ruff#30076 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour