bzr 0.7 release candidate 2
Robey Pointer
robey at lag.net
Thu Jan 19 22:33:14 GMT 2006
On 19 Jan 2006, at 7:56, John A Meinel wrote:
> Robert Collins wrote:
>> On Thu, 2006-01-19 at 01:59 -0800, Robey Pointer wrote:
>>
>>> It took me embarrassingly long to figure this out tonight.
>>> stub_sftp.py is relying on the hasattr check, and needs to be
>>> patched
>>> like so:
>>>
>>> === modified file 'bzrlib/tests/stub_sftp.py'
>>> --- bzrlib/tests/stub_sftp.py
>>> +++ bzrlib/tests/stub_sftp.py
>>> @@ -117,7 +117,7 @@
>>> try:
>>> if hasattr(os, 'O_BINARY'):
>>> flags |= os.O_BINARY
>>> - if (attr is not None) and hasattr(attr, 'st_mode'):
>>> + if (attr is not None) and hasattr(attr, 'st_mode') and
>>> attr.st_mode != 0:
>>> fd = os.open(path, flags, attr.st_mode)
>>> else:
>>> fd = os.open(path, flags)
>>
>>
>> I would write that as:
>> if getattr(attr, 'st_mode', 0) != 0:
>>
>>
>> Cheers,
>> Rob
>
> I'm curious why Robey is using '0' instead of using 'None'. None can't
> be confused for a valid mode. But anyway, we certainly should put some
> sort of fix into the bzr. I didn't see anything wrong with
> paramiko, so
> I'm glad we found the problem.
No reason except that I didn't think of it. :) I'll switch it to
None in paramiko, then use getattr(attr, 'st_mode', None) as a patch
against bzr.robey.
robey
More information about the bazaar
mailing list