fix test_recreate_basic on cygwin

looks like that chmod should only get done IF we are root (and on linux?).

taking away write permissions on windows/cygwin (and when running as normal
user) makes create_regular_file fail when it tries to create dir2/file3.
This commit is contained in:
Thomas Waldmann 2022-11-22 18:04:12 +01:00
parent f088682bc9
commit 15c51ee3c6
No known key found for this signature in database
GPG Key ID: 243ACFA951F78E01
1 changed files with 2 additions and 2 deletions

View File

@ -235,10 +235,10 @@ class ArchiverTestCaseBase(BaseTestCase):
os.mknod("input/bdev", 0o600 | stat.S_IFBLK, os.makedev(10, 20))
# Char device
os.mknod("input/cdev", 0o600 | stat.S_IFCHR, os.makedev(30, 40))
# File mode
os.chmod("input/dir2", 0o555) # if we take away write perms, we need root to remove contents
# File owner
os.chown("input/file1", 100, 200) # raises OSError invalid argument on cygwin
# File mode
os.chmod("input/dir2", 0o555) # if we take away write perms, we need root to remove contents
have_root = True # we have (fake)root
except PermissionError:
have_root = False