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
shquote breaks certain sudo commands #61
Comments
can you see if |
Also please note, that this only happens while using sudo, which triggers the "level >= self.QUOTE_LEVEL" condition in ConcreteCommand.formulate. |
@tomerfiliba doesn't work, still the same issue. |
Thinking of this further, is the formulate/shquote logic needed at all? subprocess.Popen (which is used to execute these) handles quoting itself, doesn't it? So what is the reason to use these? |
No, there's no quoting done by Popen. It only happens if shell=True.
|
Well, I meant quoting in the sense that when you subprocess.Popen(['yum', 'install', 'rubygem(rails)']), it actually works, whereas using "yum install rubygem(rails)" fails on commandline because of parentheses that are not quoted. So I'm not sure that this is actually quoting, but it does something with the parameters. |
when you do
it just places the arguments in argv of the new process, never going through the shell. in windows it does go through the shell, but that's another story. anyhow, "()" are not safe chars, because the shell uses them for its own purposes. for example, you can write
I think it would be easiest and simplest to add a RawString type, so you could do
which won't get quoted. this idea just came to me - did you try:
? |
Interesting, the sudo[yum]("install", "rubygem(rails)") seems to work fine. |
come to think of it, Tomer Filiba On Fri, May 3, 2013 at 11:20 AM, Bohuslav Kabrda
|
closing as "won't fix". there's a workaround and it's quite possible that #27 solves it. |
Hi,
when using some sudo commands I found out that they were failing where they shouldn't have. E.g.:
This fails, because rubygem(rails) gets overquoted by formulate (which calls shquote). This ends up formulated like this:
So yum in fact gets "'rubygem(rails)'" on commandline (because Popen puts the outer quotes there.
I think that the problem can be solved by adding '(' and ')' to _safechars, which seems ok to me, but I'm not sure of other consequences of this. Any other options how to solve this?
Thanks.
The text was updated successfully, but these errors were encountered: