[merge] 'bzr pull' over sftp required trailing slash
John Arbash Meinel
john at arbash-meinel.com
Fri Jul 7 18:00:09 BST 2006
I sent a post about this a while ago, but the basic summary is that when
I updated 'read_bundle_from_url' so that we could read bundles over
Transports, I caused:
bzr pull sftp://host/path/to/branch
To start failing. You had to specify it as:
bzr pull sftp://host/path/to/branch/
As near as I can tell, the problem is that the openssh server doesn't
actually try to open the file on an SFTP_OPEN request. It just returns a
handle, that doesn't fail until you try to do an SFTP_READ.
Our stub_sftp server, on the other hand, does try to os.fdopen() the
path on an SFTP_OPEN request. So it fails right away, and we get a
chance to return PathError.
Under real-world conditions, we don't fail until we .read() on the file,
and we get an IOError exception from the paramiko file object, with
str(exception) == 'Failure'.
Not exactly helpful, but that is the way some Transports work. Most
transport specs give a lot of leeway in indicating how failures should
be handled.
The attached bundle checks for this specific IOError exception.
I don't really know how to write a test for this, since it is a specific
bug with how we interact with a real ssh server.
The best I can think of is a rewrite of the Stub server to not open the
files right away.
However, the way paramiko is written, it expects you to actually open
the file. Specifically it expects Server.open() to return an SFTPHandle
object that has a readfile and a writefile object (with .read() and
.write() support respectively).
I suppose we could rewrite our StubSFTPHandle so that it used lazy
opening of the file. (Override all the functions provided by the baseclass).
Is it worth it?
John
=:->
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pull-without-trailing-slash.patch
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20060707/32290722/attachment.diff
-------------- 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/20060707/32290722/attachment.pgp
More information about the bazaar
mailing list