Skip to content
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

Spaces cause failures when using put and use_sudo #955

Closed
johnharris85 opened this issue Aug 13, 2013 · 2 comments
Closed

Spaces cause failures when using put and use_sudo #955

johnharris85 opened this issue Aug 13, 2013 · 2 comments

Comments

@johnharris85
Copy link

sftp.py (line 109):

def mkdir(self, path, use_sudo):
    from fabric.api import sudo, hide
    if use_sudo:
        with hide('everything'):
            sudo('mkdir %s' % path)

The issue here is that if use_sudo=True then mkdir will break if path contains spaces. I changed it to:

def mkdir(self, path, use_sudo):
    from fabric.api import sudo, hide
    if use_sudo:
        with hide('everything'):
            sudo('mkdir "%s"' % path)

Now it works OK. Untested but solved my issue, may cause problems for others.

@bitprophet
Copy link
Member

I feel like this should cause issues for non-sudo invocation as well - have you tested that out? Either way, agree quoting is probably useful here; we quote a few other similar places IIRC so there's likely precedent.

@bitprophet
Copy link
Member

Not sure why I said non sudo invocations would cause issues here, clearly the non sudo situation is handled natively by SFTP. Derp.

Wrote up an integration test proving this & applied the above fix. We may want to make this even more robust in the future for things like tilde escaping, but this suffices for now. Will merge into 1.7.x and 1.8.x momentarily.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants