[MERGE] Faster LocalTransport.put() and append() methods.
Robert Collins
robertc at robertcollins.net
Wed Jun 14 10:16:14 BST 2006
On Wed, 2006-06-14 at 13:36 +1000, Martin Pool wrote:
> Since you're creating the file with O_EXCL I don't see any need to
> include the PID. Instead, if that fails with EEXIST then just e.g.
> add a sequence number and try again.
O_EXCL is documented as broken on NFS. if use a static suffix - i.e.
filename + '.bzrtmp', if someone has a file that looks like that, we may
overwrite it unintentionally - *depending on the manner of the
brokenness for NFS*.
If its 'race conditions with two clients writing the same file' broken -
then I'm happy to remove the pid. If its 'O_EXCL is simply ignored on
some implementations' then I think the pid is a not-too-bad price to
pay.
> To clarify - the point of chmod is to make sure that differing umasks
> don't lead to bzrdirs with inconsistent permissions between their
> files. (e.g. most are 0660, some are 0600.)
>
> >> I would be happy with that. Problem #1 is that I don't know of any
> >> way
> >> to determine the current umask without setting it. (os.umask() will
> >> return the old umask, but only after you set a new one).
> >
> > mask = os.umask(0)
> > os.umask(mask)
>
> If we're going to do that then perhaps we can just reset our umask
> entirely while updating the repository from a try/finally block.
> That is what we're logically trying to achieve. The main problem is
> if we need to interleave access to different objects that should get
> different permissions.
And thread safety may be an issue too. I think calculating the umask
when the module is first used, and then chmodding IFF its needed is a
reasonable compromise.
Rob
--
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060614/13fb7477/attachment.pgp
More information about the bazaar
mailing list