[RFC] per-branch umask

Robey Pointer robey at lag.net
Fri Dec 16 02:58:48 GMT 2005


On 15 Dec 2005, at 15:36, John Arbash Meinel wrote:

> Robey Pointer wrote:
>>
>> On 15 Dec 2005, at 13:19, John Arbash Meinel wrote:
>>
>>> Actually, the StubSFTPServer that we use does *not* mask anything  
>>> when
>>> it does an open or mkdir. Which means that all the test cases  
>>> pass,  but
>>> in actually testing it with a real sftp server, I found that the  
>>> tests
>>> don't pass. Thanks for reminding me of this.
>>
>>
>> Weird, I would've thought umask would be handled automatically by the
>> OS.  In fact the open(2) manpage says so explicitly.  Ghosts!
>
> Not really. Your StubSFTPServer says:
> if attr:
>   SFTPServer.set_file_attr(path, attr)
>
> Which is really an os.chmod() call.

Doh.  Right.  It's abstracted away too much because 'attr' can also  
hold utime and chown data.  Never mind. :)  We could fix  
StubSFTPServer if this matters (patch attached).


> There is another issue, though. Pipelining doesn't work right away if
> you are using SFTProcess (openssh instead of paramiko's connection).
> Paramiko needs the function "recv_ready". Which for now I've just  
> forced
> with a "def recv_ready(self): return True)".
> I assume that means it would block rather than being properly  
> pipelined.
>
> On win32, I don't think I have poll() or select(), so I'll just  
> have to
> do True. But I think for Linux I can do poll().

Oooh, good catch!  I wonder if this has been slowing down sftp  
pushes.  Almost certainly, but how much...

Windows currently has no way to use SFTPProcess, because only unix- 
based ssh clients are supported, so Windows is always using  
paramiko.  Thus (for now) just doing a select() should work fine.

[[[ idle thoughts follow:
Paramiko is assuming it has a socket-like object, not a file.  You  
might try having recv_ready() always return False, which would force  
all async responses to buffer up until the file is closed.  However,  
I think I've seen some sftp servers disconnect in this case -- they  
keep getting requests but they can't write responses because the  
responses have filled up the OS buffers and TCP windows.  Paramiko  
could also be a bit smarter and track unack'd async requests, forcing  
a read after some threshold is reached, but that turns into a  
magickal tuning value. ]]]

robey


-------------- next part --------------
A non-text attachment was scrubbed...
Name: stub-sftp-umask.patch
Type: application/octet-stream
Size: 740 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051215/f55f41fd/attachment.obj 


More information about the bazaar mailing list