- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2.7k
[needs test] always shell-escape command arguments after failure #5666
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
Conversation
fixes rust-lang#5665 remove the `debug_string` method, in favour of always using the `fat::Display` impl. `debug_string` didn’t escape the command arguments, so that’s why we ended up with unescaped arguments after compilation failed
| Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @matklad (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. | 
| Nice! r=me with a test | 
The doesn’t doesn’t seem to run when I run `cargo test` though
| @bors: r+ Thanks! | 
| 📌 Commit 727684d has been approved by  | 
[needs test] always shell-escape command arguments after failure cc @joshtriplett fixes #5665 Removes the `debug_string` method, in favour of always using the `fmt::Display` impl. `debug_string` didn’t escape the command arguments, so that’s why we ended up with unescaped arguments after compilation failed. Don't merge this yet, because I still want to add a regression test. I don't think there's any tests on shell quoting yet, so I'll probably add a new test file including tests for the "Running <command>" output too. I still have to figure out how to write tests, and don't have the energy to do that tonight 😴 I just wanted to say, by the way, I was pleasantly surprised with how clean the code is in this repo, especially compared to rustc. It made it really easy to find the relevant part of the code and implement these changes.
| ☀️ Test successful - status-appveyor, status-travis | 
Even with rust-lang#5666, when commands are shown in verbose output, there are still some cases where they can’t be run in the terminal. This is because the code is expecting certain environment variables that are provided by cargo. This PR updates the `Display` impl for `ProcessBuilder` to show the environment variables in front of the command (on unix), so that the command can be run. Note that for workspaces, you will still have to run the command from the workspace root. I deliberately didn’t update any of the tests yet, because I want to see if this is desired, and figure out if there is a way to do this on windows.
Fix the shell_quoting test r? @alexcrichton add-on to #5666 - Added `mod shell_quoting;` to testsuite/main.rs, so it actually runs - fixed bugs in the test
cc @joshtriplett
fixes #5665
Removes the
debug_stringmethod, in favour of always using thefmt::Displayimpl.debug_stringdidn’t escape the commandarguments, so that’s why we ended up with unescaped arguments after
compilation failed.
Don't merge this yet, because I still want to add a regression test. I don't think there's any tests on shell quoting yet, so I'll probably add a new test file including tests for the "Running " output too. I still have to figure out how to write tests, and don't have the energy to do that tonight 😴
I just wanted to say, by the way, I was pleasantly surprised with how clean the code is in this repo, especially compared to rustc. It made it really easy to find the relevant part of the code and implement these changes.