Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
put adds unwanted backslash on recursive dir #604
I've created a sample dir tree to put:
Then create a simple fabric script to put that tree on my remote home dir:
Invoking it produces the following:
As you can see, it creates a folder not with the same name as the one on the local file system, but instead prefixes it with a backslash.
My guess the backslash is created because this script is run on Windows and Fabric doesn't recognize the backslash when traversing the path.
If someone familiar with the fabric code base would point me to where this might be occurring, I can probably put together a patch/pull request.
As an aside, it seems to take eight backslashes to remove that one backslash:
That is, there's one backslash in the file system, doubled to escape for bash, doubled again to escape for Python. What does the third doubling escape for? If I run it from the bash prompt, I only have to provide two backslashes (i.e. "rm -R \.ssh").
I had a similar problem and created the following patch in
index abaa8ef..cc37532 100644 --- a/fabric/sftp.py +++ b/fabric/sftp.py @@ -271,6 +271,7 @@ class SFTP(object): for context, dirs, files in os.walk(local_path): rcontext = context.replace(strip, '', 1) + # normalize pathname separators with POSIX separator + rcontext = rcontext.replace(os.sep, '/') rcontext = rcontext.lstrip('/') rcontext = posixpath.join(remote_path, rcontext)
The main problem is
I'm sure there is a better way to handle this, but it worked for me.
@dieresys Thanks for diagnosing this -- we don't usually test on Windows (Win support is purely on a user-contributed basis, we don't have the interest or cycles to do otherwise.)
If you could make a pull request for this that includes an update to
(p.s. if possible, I recommend using hub pull-request to turn this issue into the PR itself. Might not be doable since you didn't author it, in which case, no biggie.)