Browse Source

catch "invalid argument" on cygwin, fixes #257

obviously cygwin (windows) does not like the made-up uid 100 gid 200
and raises "invalid argument" OSError.
Thomas Waldmann 9 năm trước cách đây
mục cha
commit
72a7c0bae5
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      borg/testsuite/archiver.py

+ 5 - 1
borg/testsuite/archiver.py

@@ -288,10 +288,14 @@ class ArchiverTestCase(ArchiverTestCaseBase):
             # File mode
             # File mode
             os.chmod('input/dir2', 0o555)  # if we take away write perms, we need root to remove contents
             os.chmod('input/dir2', 0o555)  # if we take away write perms, we need root to remove contents
             # File owner
             # File owner
-            os.chown('input/file1', 100, 200)
+            os.chown('input/file1', 100, 200)  # raises OSError invalid argument on cygwin
             have_root = True  # we have (fake)root
             have_root = True  # we have (fake)root
         except PermissionError:
         except PermissionError:
             have_root = False
             have_root = False
+        except OSError as e:
+            if e.errno != errno.EINVAL:
+                raise
+            have_root = False
         return have_root
         return have_root
 
 
     def test_basic_functionality(self):
     def test_basic_functionality(self):