]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-95675: fix uid and gid at test_add_dir_getmember (gh-102207)
authorSKO <41810398+uyw4687@users.noreply.github.com>
Sat, 25 Feb 2023 02:26:40 +0000 (11:26 +0900)
committerGitHub <noreply@github.com>
Sat, 25 Feb 2023 02:26:40 +0000 (11:26 +0900)
Co-authored-by: Seonkyo Ok <seonkyo.ok@linecorp.com>
Lib/test/test_tarfile.py
Misc/ACKS

index f15a800976681cf5c78b2683aecfd6b34313d5e0..75b60e9a50e78afab930a5cfec3b8edd0367298d 100644 (file)
@@ -225,18 +225,19 @@ 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."
-    )
+    @unittest.skipUnless(hasattr(os, "getuid") and hasattr(os, "getgid"),
+                         "Missing getuid or getgid implementation")
     def add_dir_and_getmember(self, name):
+        def filter(tarinfo):
+            tarinfo.uid = tarinfo.gid = 100
+            return tarinfo
+
         with os_helper.temp_cwd():
             with tarfile.open(tmpname, 'w') as tar:
                 tar.format = tarfile.USTAR_FORMAT
                 try:
                     os.mkdir(name)
-                    tar.add(name)
+                    tar.add(name, filter=filter)
                 finally:
                     os.rmdir(name)
             with tarfile.open(tmpname) as tar:
index 43e420a1373cb740c92f6f5a5589c167bd8c5583..3403aee4cc78ff402ea1b14c84a6586d0dfc1dab 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -1308,6 +1308,7 @@ Jon Oberheide
 Milan Oberkirch
 Pascal Oberndoerfer
 Géry Ogam
+Seonkyo Ok
 Jeffrey Ollie
 Adam Olsen
 Bryan Olson