[RFC/merge] Assert that readv() is returning the right data

John Arbash Meinel john at arbash-meinel.com
Tue Sep 12 18:08:39 BST 2006


John Arbash Meinel wrote:
> I realized we had a potential bug in Transport, where if a read()
> returned a short amount of data, it could cause bogus results elsewhere.
> 
> So I investigated updating the Transport.readv() api, so that if a short
> read occurs, it raises an ShortReadvError, rather than silently failing.
> 

...

> The other fix I can think of, is to write a test case, and make sure
> that either ShortReadvError or AssertionError is raised, but I don't
> really like catching AssertionError.
> 

Attached is an alternative that we can use if we prefer. It also finds a
bug in 'SFTPTransport.readv()' when the seek is outside of the file.
(The inner loop returns no data, so the outer loop returns no texts, but
no errors are ever raised).

Only SFTP fails with AssertionError, so it might be reasonable to change
the test to only allow AssertionError in the case that the transport is
sftp.

John
=:->

-------------- next part --------------
A non-text attachment was scrubbed...
Name: short_read.patch
Type: text/x-patch
Size: 7627 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060912/5b5ae937/attachment.bin 
-------------- 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/20060912/5b5ae937/attachment.pgp 


More information about the bazaar mailing list