[MERGE] OSX's mkdtemp assigns wrong group by default
John Arbash Meinel
john at arbash-meinel.com
Sun Aug 31 15:12:00 BST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Vincent Ladeuil wrote:
> This patch fixes the TestPermissions tests failing under OSX.
>
> The root cause is that OSX create temporary directories assigned
> to the 'wheel' group and the tests want to set the group sticky
> bit. The user running the tests is not a 'wheel' member and
> cannot do that.
>
> The fix introduces a dedicated osutils._mac_mkdtemp that set a
> correct group and makes it the osutils.mkdtemp when run under
> OSX.
>
> It also fixes all direct calls to tempfile.mkdtemp to
> osutils.mkdtemp
>
> An alternative approach will be to skip the permissions tests on
> OSX since bzr itself doesn't directly care about group owner
> (outside of the failing tests).
>
> Vincent & Guillermo
>
>
It is *good* to switch everything over to osutils.mkdtemp() since we really
need that for Windows anyway. I don't know that we need to create a custom
function just for that one test.
Why not just modify the test to do:
dir = mkdtemp()
if sys.platform == 'darwin':
# OS X creates temp dirs with the 'wheel' group, which users are not likely
# to be in, and this prevents us from setting the sgid bit
os.chown(dir, os.getuid(), os.getgid())
I would certainly be more comfortable modifying the one test that needs group,
rather than everytime someone creates a temp dir.
(I *would* like to test the sgid bit, as it has effects when you to chmod 2775
.bzr, to make sure that the subdirs created also have setgid.)
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFIuqawJdeBCYSNAAMRAn6EAKCZX7+Ko9eAAcwPfWNm5jtOHlieEACfYm7B
Siq9r0HE/Wq2fTOX69Jg9uY=
=PQtN
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list