[RFC] per-branch umask
John Arbash Meinel
john at arbash-meinel.com
Tue Dec 13 19:08:55 GMT 2005
Matthieu Moy wrote:
> John Arbash Meinel <john at arbash-meinel.com> writes:
>
>
>>I think it would be nice to have a umask value set for a branch, so that
>>clients will respect it when committing to that directory. That would
>>mean it needs to be inside .bzr, so that all clients see it.
>
>
> Isn't what you want to do just the following:
>
> * bzr doesn't change the permission for existing files
Sure.
>
> * When bzr creates a new file/directory, it inherits the permission
> bits of the parent directory, not the current umask.
>
> Then, setting the "local umask" for a branch is just "chmod -R .bzr/".
>
The problem is that you need to unset umask, so that you create the file
with the mode of the parent directory (minus the executable bit and
sticky bits).
In python open('foo'), doesn't allow you to specify the mode bits.
os.open() does, but the bits are always masked against the umask.
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)
That could also be done in the sftp code.
Is that reasonable to do?
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/084579d7/attachment.pgp
More information about the bazaar
mailing list