-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
{x,y,z} parameter expansion is not escaped #4629
Comments
I don't agree with that diagnosis. Here is what I do to debug arguments:
|
I use > string escape -- hello\ {1,2,3}.txt\n
hello\ 1.txt\n
hello\ 2.txt\n
hello\ 3.txt\n which means you actually get what I'd expect. You get the full argument with "1", then with "2" and then with "3". The full argument just happens to include a newline. @mqudsi: I would assume what's throwing you off here is one of a couple of things:
Or in
That means if you want to have the output
use I believe this is a misunderstanding, rather than a bug. Am I correct? |
Sorry, folks! I was trying to come up with a minimal repro for an issue and was confused by something completely different. I got the behavior of parameter expansion wrong, in particular, I confused it with that of Thanks for setting me straight. |
Fish parameters are, as a rule, escaped before being injected into fish commands:
However, the result of braces expansion is not correctly escaped, and there's no easy way to escape to manually escape it as introducing quotes around the parameter breaks the expansion:
As you can see, after the first parameter,
echo
is being passed two separate argumentshello
and#.txt
, leading to the extra space in front of the words.Wrapping the arguments in quotes leads to the following:
While attempting to work around the issue by inserting escaped quotes into the original string (under the presumption that the contents of the string are not being escaped after replace and before injection) leads to the quotes being correctly escaped, preventing the desired result:
It looks like the parameter expansion is happening after the argument splitting stage.
The text was updated successfully, but these errors were encountered: