Sudo doesn't preserves the command line as-is
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 38/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- rust
- 領域
- cli, operating-systems
調査の方向性
まず、cmd.exe で sudo run --inline -- を使って 2 つのコマンドペアを再現し、GetCommandLineW() の出力を比較します。レポートで参照されている CreateProcessW のコマンドライン動作と、Microsoft C Runtime の解析規則を読んでください。完了条件は、inline コマンドが期待される出力に示された元のスペースと埋め込み引用符を保持することです。
索引モデルが issue の本文から書いたものです。
説明
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".
- 主要言語
- Rust
- スター
- 5.9k
- フォーク
- 180
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/sudo のほかの issue
-
Issue-Bug Needs-Triage
難易度 1/5 1時間未満 初心者へのやさしさ 74/100
-
Issue-Bug Needs-Triage
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
-
Issue-Feature Needs-Triage
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
-
Issue-Bug Needs-Triage
難易度 3/5 1〜2日 初心者へのやさしさ 65/100
-
Issue-Bug Needs-Triage
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
似ている issue
-
good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
NuSkooler/enigma-bbs#907 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
bug pixi-build-r
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
prefix-dev/pixi#7229 ·
メンテナーはふだん 1 日以内に返信