-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Strings with a backslash before the ending quote results in a quote being included in the final arg value #2791
Comments
What does rust's |
dbg!(env::args_os()); prints
In clean form, that would indeed be |
Yup, So it looks like some kind of rust or most probably a shell issue. We can't do anything on our side. |
Unsure how relevant this is but Rust 1.56 came with this compatibility note:
|
I am interested in what happens when you try 1.56 instead of 1.54. |
I just tried on rust version $ rustc -V
rustc 1.56.0-beta.3 (deef86610 2021-09-17)
$ cargo run -- '.\foo bar\baz\'
Compiling clap v2.33.3
Compiling clap-mwe-backslash-quote v0.1.0 (C:\Users\Adrian\coding\testing\clap-mwe-backslash-quote)
Finished dev [unoptimized + debuginfo] target(s) in 4.45s
Running `target\debug\clap-mwe-backslash-quote.exe ".\foo bar\baz\""`
[src\main.rs:5] env::args_os() = ArgsOs {
inner: [
"target\\debug\\clap-mwe-backslash-quote.exe",
".\\foo bar\\baz\"",
],
}
.\foo bar\baz" Doesn't seem to have changed anything. |
Please complete the following tasks
Rust Version
rustc 1.54.0 (a178d0322 2021-07-26)
Clap Version
2.33.3
Minimal reproducible code
Steps to reproduce the bug with the above code
Actual Behaviour
The following is printed:
Notice the trailing
"
- there was not even a direct"
in the original input.Expected Behaviour
Either of the two:
.\foo bar\baz\
.'
is meant to be escaped by\
, a parse error saying no end'
was found.Additional Context
This is on Windows and is particularly an issue with paths. Assume you have the following directory tree:
If you autocomplete in PowerShell, the path will be
'.\foo bar\baz\'
(including the quotes because of the space).I saw the discussion at #2654, but I'm not sure it's the same issue.
Debug Output
The text was updated successfully, but these errors were encountered: