| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b6f1be5 commit ee1fab9
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3260,23 +3260,43 @@ def test_modes(self): | |||
| 3260 | 3260 | arc.add('exec_group_other', mode='?rw-rwxrwx') | |
| 3261 | 3261 | arc.add('read_group_only', mode='?---r-----') | |
| 3262 | 3262 | arc.add('no_bits', mode='?---------') | |
| 3263 | - arc.add('dir/', mode='?---rwsrwt', type=tarfile.DIRTYPE) | ||
| 3263 | + arc.add('dir/', mode='?---rwsrwt') | ||
| 3264 | + | ||
| 3265 | + # On some systems, setting the sticky bit is a no-op. | ||
| 3266 | + # Check if that's the case. | ||
| 3267 | + tmp_filename = os.path.join(TEMPDIR, "tmp.file") | ||
| 3268 | + with open(tmp_filename, 'w'): | ||
| 3269 | + pass | ||
| 3270 | + os.chmod(tmp_filename, os.stat(tmp_filename).st_mode | stat.S_ISVTX) | ||
| 3271 | + have_sticky_files = (os.stat(tmp_filename).st_mode & stat.S_ISVTX) | ||
| 3272 | + os.unlink(tmp_filename) | ||
| 3273 | + | ||
| 3274 | + os.mkdir(tmp_filename) | ||
| 3275 | + os.chmod(tmp_filename, os.stat(tmp_filename).st_mode | stat.S_ISVTX) | ||
| 3276 | + have_sticky_dirs = (os.stat(tmp_filename).st_mode & stat.S_ISVTX) | ||
| 3277 | + os.rmdir(tmp_filename) | ||
| 3264 | 3278 | ||
| 3265 | 3279 | with self.check_context(arc.open(), 'fully_trusted'): | |
| 3266 | - self.expect_file('all_bits', mode='?rwsrwsrwt') | ||
| 3280 | + if have_sticky_files: | ||
| 3281 | + self.expect_file('all_bits', mode='?rwsrwsrwt') | ||
| 3282 | + else: | ||
| 3283 | + self.expect_file('all_bits', mode='?rwsrwsrwx') | ||
| 3267 | 3284 | self.expect_file('perm_bits', mode='?rwxrwxrwx') | |
| 3268 | 3285 | self.expect_file('exec_group_other', mode='?rw-rwxrwx') | |
| 3269 | 3286 | self.expect_file('read_group_only', mode='?---r-----') | |
| 3270 | 3287 | self.expect_file('no_bits', mode='?---------') | |
| 3271 | - self.expect_file('dir', type=tarfile.DIRTYPE, mode='?---rwsrwt') | ||
| 3288 | + if have_sticky_dirs: | ||
| 3289 | + self.expect_file('dir/', mode='?---rwsrwt') | ||
| 3290 | + else: | ||
| 3291 | + self.expect_file('dir/', mode='?---rwsrwx') | ||
| 3272 | 3292 | ||
| 3273 | 3293 | with self.check_context(arc.open(), 'tar'): | |
| 3274 | 3294 | self.expect_file('all_bits', mode='?rwxr-xr-x') | |
| 3275 | 3295 | self.expect_file('perm_bits', mode='?rwxr-xr-x') | |
| 3276 | 3296 | self.expect_file('exec_group_other', mode='?rw-r-xr-x') | |
| 3277 | 3297 | self.expect_file('read_group_only', mode='?---r-----') | |
| 3278 | 3298 | self.expect_file('no_bits', mode='?---------') | |
| 3279 | - self.expect_file('dir/', type=tarfile.DIRTYPE, mode='?---r-xr-x') | ||
| 3299 | + self.expect_file('dir/', mode='?---r-xr-x') | ||
| 3280 | 3300 | ||
| 3281 | 3301 | with self.check_context(arc.open(), 'data'): | |
| 3282 | 3302 | normal_dir_mode = stat.filemode(stat.S_IMODE( | |
@@ -3286,7 +3306,7 @@ def test_modes(self): | |||
| 3286 | 3306 | self.expect_file('exec_group_other', mode='?rw-r--r--') | |
| 3287 | 3307 | self.expect_file('read_group_only', mode='?rw-r-----') | |
| 3288 | 3308 | self.expect_file('no_bits', mode='?rw-------') | |
| 3289 | - self.expect_file('dir/', type=tarfile.DIRTYPE, mode=normal_dir_mode) | ||
| 3309 | + self.expect_file('dir/', mode=normal_dir_mode) | ||
| 3290 | 3310 | ||
| 3291 | 3311 | def test_pipe(self): | |
| 3292 | 3312 | # Test handling of a special file | |
| Back | FazBrowse Home | New Git URL |
0 commit comments