64
64
' permission logic')
65
65
if sys.platform == 'win32':
66
66
raise tests.TestNotApplicable('chmod has no effect on win32')
67
elif sys.platform == 'darwin':
68
# OS X creates temp dirs with the 'wheel' group, which users are
69
# not likely to be in, and this prevents us from setting the sgid
71
os.chown(self.test_dir, os.getuid(), os.getgid())
72
67
# also, these are BzrBranch format specific things..
74
69
mode = stat.S_IMODE(os.stat('a').st_mode)
79
74
self.assertEqualMode(mode, b.control_files._dir_mode)
80
75
self.assertEqualMode(mode & ~07111, b.control_files._file_mode)
79
b = self.make_branch('d')
80
self.assertEqualMode(0700, b.bzrdir._get_dir_mode())
81
self.assertEqualMode(0600, b.bzrdir._get_file_mode())
82
self.assertEqualMode(0700, b.control_files._dir_mode)
83
self.assertEqualMode(0600, b.control_files._file_mode)
84
check_mode_r(self, 'd/.bzr', 00600, 00700)
86
def test_new_branch_group_sticky_bit(self):
87
if isinstance(self.branch_format, RemoteBranchFormat):
88
# Remote branch format have no permission logic in them; there's
89
# nothing to test here.
90
raise tests.TestNotApplicable('Remote branches have no'
92
if sys.platform == 'win32':
93
raise tests.TestNotApplicable('chmod has no effect on win32')
94
elif sys.platform == 'darwin':
95
# OS X creates temp dirs with the 'wheel' group, which users are
96
# not likely to be in, and this prevents us from setting the sgid
98
os.chown(self.test_dir, os.getuid(), os.getgid())
99
# also, these are BzrBranch format specific things..
100
t = self.make_branch_and_tree('.')
83
103
os.chmod('b', 02777)
84
104
b = self.make_branch('b')
97
117
self.assertEqualMode(00640, b.control_files._file_mode)
98
118
check_mode_r(self, 'c/.bzr', 00640, 02750)
102
b = self.make_branch('d')
103
self.assertEqualMode(0700, b.bzrdir._get_dir_mode())
104
self.assertEqualMode(0600, b.bzrdir._get_file_mode())
105
self.assertEqualMode(0700, b.control_files._dir_mode)
106
self.assertEqualMode(0600, b.control_files._file_mode)
107
check_mode_r(self, 'd/.bzr', 00600, 00700)
109
120
def test_mode_0(self):
110
121
"""Test when a transport returns null permissions for .bzr"""
111
122
if isinstance(self.branch_format, RemoteBranchFormat):