[merge] bzr uses permissions of containing directory
John Arbash Meinel
john at arbash-meinel.com
Thu Dec 15 22:05:09 GMT 2005
After much gnashing of teeth, I have updated the Transport interface,
Branch itself, such that it know checks to see what the mode of '.bzr'
is, and then uses that to determine the permissions for all files
underneath.
You can see my changes here:
http://bzr.arbash-meinel.com/branches/bzr/permissions/
Basically, the main changes are that we do an extra stat() when a
BzrBranch is created to figure out what the permissions should be. And
pass that to the stores.
Then whenever put() or mkdir() is called, it is passed a mode parameter,
which tells the transport to call chmod() afterwards. (Actually, in both
Local and Sftp, it is done on the temporary file we are writing to.)
I realized after doing all the work, that probably the only chmod that
matters is the one done to the directories. Because we never open a file
in append mode, we only replace the contents. In the future when we have
knits, that will change, though, so I wouldn't be too quick to rip out
the code. (The other nice thing is that with knits, we normally append()
so we won't have the extra stat call either).
Because of this, though. I went ahead and added 2 flags:
BzrBranch._set_file_mode
BzrBranch._set_dir_mode
It would be trivial to create a plugin which sets these to off. And then
it tels BzrBranch to ignore whatever modes it finds, which means it
passes the Transports None, which is interpreted as "don't do anything".
I would like some people to test this. I'm pretty sure it will do what
*I* want. (Which is let me collaborate with my group, and have bzr not
mess up the permissions).
Michael, if you have some extra large trees that you can test the
branch/push/pull speed on (especially over slow sftp) perhaps both with
file_mode and dir_mode enabled and disabled.
Right now, a safe and fast default would be to disable file_mode and
enable dir_mode. Once we get knits we could re-enable file_mode, as it
would both be necessary, and wouldn't be as much of a performance hit.
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/20051215/47c5ea2e/attachment.pgp
More information about the bazaar
mailing list