SFTP tests fail on Windows

John Arbash Meinel john at arbash-meinel.com
Mon May 1 23:05:46 BST 2006


Alexander Belchenko wrote:

...

>> I don't know if you have any time to look into it Alexander, but since
>> you raised the issue, I thought I would mention what I thought was the
>> solution.
> 
> I've just install fresh paramiko on my machine and run bzr selftest.
> During selftest I've got numerous messages like that:
> 
> bzr: WARNING: Exception from within unit test server thread:
> <exceptions.AttributeError instance at 0x03365940>
> 
> In test.log I see numerous errors in SFTP tests that point to 2 similar
> errors: NoSuchFile and FileExists. Probably this errors raised because
> of path issues. How can I help to fix it?
> 
> I need to have working SFTP transport because I want to use it in my
> real work: I have 2 machines connected together (windows and linux). I
> can connect to linux machine from windows via ssh. And I want to use bzr
> to version control some files from linux machine.
> 
> -- 
> Alexander


Well, in actuality, SFTP works just fine under windows. I frequently
checkout code from a Linux box onto my Windows machine.
The big issue is that the tests fail, because bzr isn't able to get a
file over sftp from a windows machine, because it doesn't know how to
request the file H:/foo.
As I outlined above, it should probably be requesting the file:
sftp://localhost/H|/foo
or at the very least
sftp://localhost/H:/foo

I don't know what sftp servers exist for windows, so I don't know what
the "official" paths look like, but I think the above path will at least
get us 90% of the way.

(The biggest trick is that right now the code just does:
sftp_url = "sftp://localhost" + abspath(path)

But for win32 it needs to do:
sftp_url = "sftp://localhost/" + munge(abspath(path))
                            ^--very important

We also need to modify the StubSFTPServer, so that when running on
windows, it knows to remove the extra '/', and to unmunge the path.

munge() is probably an optional function. It should change H:\ into H|/.
If you use osutils.abspath() the forward slash should already be taken
care of, so you just need to change : => |. (But again, this step may be
optional, I think we should support it, but probably not require it).

John
=:->


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060501/bbd5da2b/attachment.pgp 


More information about the bazaar mailing list