[MERGE][#230567] Faster (local) branch

John Arbash Meinel john at arbash-meinel.com
Thu May 29 03:25:21 BST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Robert Collins wrote:
| On Thu, 2008-05-29 at 11:38 +1000, Andrew Bennetts wrote:
|> Robert Collins wrote:
|> [...]
|>> It was an experimental branch Aaron and I created in London a couple of
|>> years back; at that time we didn't see a performance gain - but a
|>> smaller delta now will show up more - we have moved the goalposts a long
|>> way.
|>>
|>> however - os.open() still honours umask, which as I recall is why we
|>> discarded the branch.
|> umasks don't cause the execute bit to be set by default, though:
|
| Right, but they do prevent the exec bit being set, which means one still
| needs to do a chmod to be sure it has actually happened (unless we
| change the umask from within bzrlib, which is somewhat distateful to do
| as a library).
|
| -Rob

Right, but we can do what we do in Transport.put_file_non_atomic:

fd = os.open(path, flags, mode)
st = os.fstat(fd)
if mode is not None and mode != S_IMODE(st.st_mode):
~    # Because of umask, we may still need to chmod the file.
~    # But in the general case, we won't have to
~    os.chmod(abspath, mode)

basically, we allow for the fact that umask may not let us set what we want
right away, but fstat is pretty cheap on an open file, and we then chmod if we
have to.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkg+FBEACgkQJdeBCYSNAAOpfwCdEhO+2srEApxlqiFsAf6vqtC5
zl8AoNKia1K4NesMbGI6QBaXU/uXWCNw
=WJaI
-----END PGP SIGNATURE-----



More information about the bazaar mailing list