cd() and put(use_sudo=True) do not play nice together #342

bitprophet opened this Issue Aug 19, 2011 · 2 comments


None yet

2 participants



When wrapping a put(x, y, use_sudo=True) call within a with cd(): block, the hidden sudo(mv) call inside put (which moves the file from its temp location to the final destination) is honoring the cd prefix. The mv call uses a relative path in its first argument (I assume because we didn't want to specify an absolute remote temporary location?) and is thus in the wrong directory when it actually runs.

The obvious solution is to use an absolute path for the use_sudo=True temporary location. So either assume the remote system has a /tmp, or (probably better) determine the remote user's home directory as an absolute path, and then use that explicitly instead of implicitly.

Submitted by irc user dsx4ever / Egor M.

Originally submitted by Jeff Forcier (bitprophet) on 2011-04-25 at 09:06pm EDT


  • Duplicated by #398: operations.put with use_sudo=True does not work inside "cd" context manager
@bitprophet bitprophet was assigned Aug 19, 2011
Pacek commented Aug 30, 2011

Having same problem ;(


This also effects, by proxy, upload_template when used in the same situation (inside cd, and using use_sudo=True.) Confirmed report from IRC user easylancer.

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