Sudo doesn't preserves the command line as-is
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 38/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- rust
- Lĩnh vực
- cli, operating-systems
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện hai cặp lệnh trong cmd.exe với sudo run --inline -- và so sánh đầu ra của GetCommandLineW(). Đọc hành vi dòng lệnh của CreateProcessW và các quy ước phân tích cú pháp của Microsoft C Runtime được tham chiếu trong báo cáo. Được coi là hoàn tất khi các lệnh inline giữ nguyên khoảng trắng ban đầu và các dấu ngoặc kép nhúng được hiển thị trong các đầu ra mong đợi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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".
- Ngôn ngữ chính
- Rust
- Star
- 5.9k
- Fork
- 180
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/sudo
-
Invalid translation in helpĐang mởIssue-Bug Needs-Triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 74/100
-
Issue-Bug Needs-Triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
-
Issue-Feature Needs-Triage
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
-
Issue-Bug Needs-Triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
-
Issue-Bug Needs-Triage
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
Tất cả issue của microsoft/sudo
Issue tương tự
-
llm translation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
CybercentreCanada/sawp#13 ·
-
area: backend type: enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 61/100
armadavalor/WinKnife#6 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
5omeOtherGuy/phaseone#870 ·
Maintainer thường phản hồi trong vòng 1 ngày