]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-101334: Don't force USTAR format in test_tarfile. (GH-101572)
authorGregory P. Smith <greg@krypto.org>
Sun, 5 Feb 2023 17:44:57 +0000 (09:44 -0800)
committerGitHub <noreply@github.com>
Sun, 5 Feb 2023 17:44:57 +0000 (09:44 -0800)
That causes the test to fail when run using a high UID as that ancient format
cannot represent it. The current default (PAX) and the old default (GNU) both
support high UIDs.

Lib/test/test_tarfile.py
Misc/NEWS.d/next/Tests/2023-02-04-17-24-33.gh-issue-101334._yOqwg.rst [new file with mode: 0644]

index 213932069201b96ef9b10a1e06f64ab1f30ddcca..f15a800976681cf5c78b2683aecfd6b34313d5e0 100644 (file)
@@ -225,6 +225,11 @@ class UstarReadTest(ReadTest, unittest.TestCase):
         self.add_dir_and_getmember('bar')
         self.add_dir_and_getmember('a'*101)
 
+    @unittest.skipIf(
+        (hasattr(os, 'getuid') and os.getuid() > 0o777_7777) or
+        (hasattr(os, 'getgid') and os.getgid() > 0o777_7777),
+        "uid or gid too high for USTAR format."
+    )
     def add_dir_and_getmember(self, name):
         with os_helper.temp_cwd():
             with tarfile.open(tmpname, 'w') as tar:
diff --git a/Misc/NEWS.d/next/Tests/2023-02-04-17-24-33.gh-issue-101334._yOqwg.rst b/Misc/NEWS.d/next/Tests/2023-02-04-17-24-33.gh-issue-101334._yOqwg.rst
new file mode 100644 (file)
index 0000000..2a95fd9
--- /dev/null
@@ -0,0 +1 @@
+``test_tarfile`` has been updated to pass when run as a high UID.