[RFC] per-branch umask
Jan Hudec
bulb at ucw.cz
Wed Dec 14 09:41:45 GMT 2005
On Tue, Dec 13, 2005 at 14:25:14 -0600, John Arbash Meinel wrote:
> 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).
Sftp does not support setting umask, so doing chmod sounds reasonable
there.
For local transport, why can't it:
* set umask to 0
* use os.open instead of open and pass the desired mode in.
(depends on whether anything except local transport can create files).
They may not behave consistently with each other (since local transport
would not modify permissions of existing files while sftp might), but I
don't think there is a problem with that. Let's require all the storage
files in .bzr have the same permissions.
--
Jan 'Bulb' Hudec <bulb at ucw.cz>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051214/317b5b5c/attachment.pgp
More information about the bazaar
mailing list