Error running update on remote path containing a space
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Plugin to Update Remote Trees |
Fix Released
|
Medium
|
Mark Patterson |
Bug Description
For example:
$ bzr push
Using saved location: sftp://
running "ssh talisker3 bzr update /home/mark/Matlab Utilities/"
bzr: ERROR: extra argument to command update: Utilities/
No new revisions to push.
I believe the solution is just to wrap the path in quotes when sending it over ssh:
=== modified file 'push_and_
--- push_and_update.py 2007-12-14 22:41:55 +0000
+++ push_and_update.py 2008-04-10 13:33:42 +0000
@@ -145,6 +145,7 @@
if path.startswith
path = path[3:] # This is meant to be a relative path
+ path = '"%s"' % (path,) # Wrap the path in quotes in case it contains spaces
remote_bzr = target_
cmd = ['ssh', user+host+port, remote_bzr, 'update', path]
This seems to be an interaction between ssh and parameters passed to it. By using a list, we are properly passing it as a single argument, but then ssh passes it to the next shell as a plain string.
It happens on the command line as well:
ssh juju python -c "import sys; print sys.argv" fo bar bar
sys.argv fo bar bar
File "<string>", line 1
import
^
SyntaxError: invalid syntax
versus:
ssh juju python -c "'import sys; print sys.argv'" fo bar bar
['-c', 'fo', 'bar', 'bar']
I wish there was a better way, since this would have problems if there was a ", etc. But I guess as a workaround for how ssh invokes the remote shell, it is all we can really do. I'll merge it.