[RFC] per-branch umask

John Arbash Meinel john at arbash-meinel.com
Tue Dec 13 20:25:14 GMT 2005


Matthieu Moy wrote:
> John Arbash Meinel <john at arbash-meinel.com> writes:
> 
> 
>>I suppose inside the transport.put function we could do:
>>	f = open(fn, 'wb')
>>	dir_mode = stat.S_IMODE(os.stat(os.path.dirname(fn)).st_mode)
>>	os.fchmod(f.fileno(), dir_mode & 0666)
> 
> 
> Hmm, the problem is that as I understand, "put" doesn't make any
> difference between adding a new file and changing an old one, so you
> have to do the stat+chmod every time. That's probably completely
> acceptable for a local access, but means a lot of round-trips for
> remote accesses.
> 
> One possible optimization would be to factor out the "stat" part when
> creating several files in the same directory.
> 
> Perhaps a solution would be to use the permissions of .bzr/ itself as
> umask. Only one "stat" would be needed, and a single "umask" can be
> set when available.
> 
> Doing a "chmod -R /path/to/branch" is quite natural to change the
> permissions on an archive, so it would be nice if bzr could just keep
> the permissions of the complete branch (the .bzr part) consistant.
> 

I agree that there is a lot of overhead of new stat calls. If people
think that just the permission of .bzr is sufficient it is easier to
implement. It probably means that put will need to have a mode, since it
won't know what .bzr is (Transports don't know anything about layout,
they just move files around).

John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051213/8236fe06/attachment.pgp 


More information about the bazaar mailing list