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
Overzealous string quoting / space escaping #124
Comments
I've confirmed this bug with plumbum 1.4.2 as well. |
you mustn't use |
please close the issue if it does |
Thanks, but exactly the same results with the suggested syntax. |
Is there a view to see the exact string that is executed by plumbum ()? May not be related but I am having some trouble with adb shell commands with: /Library/Python/2.7/site-packages/plumbum/commands/processes.pyc in run_proc(proc, retcode, timeout) ProcessExecutionError: Command line: ['/Users/redacted/adb', '-s', "'redacted device id'", "install -r 'someapkname.apk'"] Am I missing something or is this related to string quoting or string formatting? |
i realized i was doing: adb_ = local["adb"] The string "-r install" was the problem. When broken up, all was well. |
@tomerfiliba, do you have any tips on further debugging this? |
i found that changing the order of brackets solves the issue for me. e.g. |
Thanks, it did help. There's definitely something fishy going on, though. print(sudo[reflector]['--save', '/etc/pacman.d/mirrorlist', '--sort', 'score', '--latest', '30', countries]) Incorrectly prints /usr/bin/sudo /usr/bin/reflector --save /etc/pacman.d/mirrorlist --sort score --latest 30 --country United States --country Canada while actually running sudo[reflector]['--save', '/etc/pacman.d/mirrorlist', '--sort', 'score', '--latest', '30', countries]() works, and the output file reports that the command was run as reflector --save /etc/pacman.d/mirrorlist --sort score --latest 30 --country 'United States' --country Canada |
print can be misleading, you should use
|
I'm seeing what I think is this same problem, in my case calling mysqldump and passing the password on the command line. The password contains an asterisk, which triggers shell escaping. This would be fine, except that the mysqldump command is nested in a nice command so that it doesn't slow my db server to a crawl. This makes the password get escaped a second time, essentially injecting quotes into my password. This of course, makes the command fail, as I'm not sending the wrong password. I think this issue should be reopened, as it looks like auto-escaping is broken for any nested commands. Here's an example of what I'm trying to do: r_nice["-n", "20", r_mysqldump["--password"]["1234567890*"]] note that I have to use separate bindings to add |
Same trick would work here too:
|
Unfortunately it doesn't work, for a couple of reasons:
|
What would be nice (feature request!) would be a way to turn off auto-escaping for a given command. Maybe a flag that could be set that |
For future searchers, I was able to work around my issue by using the MYSQL_PWD environment variable, thus avoiding passing the password on the command line. I'd still like to see a way to disable (or otherwise control) plumbum's auto-escaping behavior in future though. |
yep, that's a good idea. please open a different issue on that. -tomer Tomer Filiba On Thu, Nov 13, 2014 at 2:18 AM, Kevin Horn notifications@github.com
|
Hi,
I'm using plumbum 1.4.1 to call reflector on Arch Linux. I'm not sure what the problem is, but somewhere along the way, way too much string/space escaping happens.
Here is code to reproduce the problem:
This yields the output
/usr/bin/sudo /usr/bin/reflector --save /etc/pacman.d/mirrorlist --sort score --latest 30 --country 'United States' --country Canada
which looks perfect. If I run that printed command exactly, I get the desired result. However, that is not what gets run by the final line in
update_mirrorlist
. The generated mirrorlist does not include anything from the United States, and the comments report that the command actually run wasThe text was updated successfully, but these errors were encountered: