-
Notifications
You must be signed in to change notification settings - Fork 540
Use raw_arg on Windows to fix handling of spaces in commands #2689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
On Windows Rust escapes arguments for security reasons, but since we are passing an argument to a shell (i.e. can execute arbitrary code anyway), this should be disabled in order to correctly support quoting and spaces in commands. https://doc.rust-lang.org/std/process/index.html#windows-argument-splitting Fixes casey#1639.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thank you for the PR!
- Can you add a test for this? I want to make sure I understand the issue being fixed, and since it's subtle, make sure that there isn't a regression in the future.
- Should we use this for all arguments? If not, why not?
- See comments.
|
…n for raw_arg Co-authored-by: Casey Rodarmor <casey@rodarmor.com>
@jhasse The test can go in |
I've tried to run the test in windows.rs but it failed:
Is there anything I need to set up on Windows to run the tests? Do I need to install Cygwin? |
Can you commit and push your failing test to the branch, so I can see it? |
I've pushed my attempt for a test for this issue. |
Nice, thank you! I think the issue is that |
No, |
@jhasse TIL! Check out the test logs, I'm seeing some failures in the unit tests which I don't understand. |
Hm ... me neither :( I've tried setting RUST_BACKTRACE=1 to get a better understanding. No idea if that is the right way forward. |
I think that in order to fix this, you'll need to be able to run the tests locally, otherwise the debug loop will be really slow if you have to run the tests on CI. Are you set up to do Windows Rust development? I have a Windows laptop I use for stuff like this, but I'm pretty busy so I don't know when I'll be able to get it out to take a look. |
I have a Windows setup, but the test fail, even on the master branch (see #2689 (comment)). |
On Windows Rust escapes arguments for security reasons, but since we are passing an argument to a shell (i.e. can execute arbitrary code anyway), this should be disabled in order to correctly support quoting and spaces in commands.
https://doc.rust-lang.org/std/process/index.html#windows-argument-splitting
Fixes #1639.