diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-02-25 02:56:08 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-25 02:56:08 (GMT) |
commit | 3e80d21b7673edf70753e14d88907c60bc6970c3 (patch) | |
tree | 64446e9701a806c88ad3e59e3c3891deaa8c2203 | |
parent | 2e2ab6752b9815490df366f50d022cdda1235511 (diff) | |
download | cpython-3e80d21b7673edf70753e14d88907c60bc6970c3.zip cpython-3e80d21b7673edf70753e14d88907c60bc6970c3.tar.gz cpython-3e80d21b7673edf70753e14d88907c60bc6970c3.tar.bz2 |
[3.10] gh-95675: fix uid and gid at test_add_dir_getmember (gh-102207) (gh-102230)
gh-95675: fix uid and gid at test_add_dir_getmember (gh-102207)
(cherry picked from commit 56e93c8020e89e1712aa238574bca2076a225028)
Co-authored-by: Seonkyo Ok <seonkyo.ok@linecorp.com>
-rw-r--r-- | Lib/test/test_tarfile.py | 13 | ||||
-rw-r--r-- | Misc/ACKS | 1 |
2 files changed, 8 insertions, 6 deletions
diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py index cba95e9..89f5a56 100644 --- a/Lib/test/test_tarfile.py +++ b/Lib/test/test_tarfile.py @@ -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: @@ -1286,6 +1286,7 @@ Jon Oberheide Milan Oberkirch Pascal Oberndoerfer Géry Ogam +Seonkyo Ok Jeffrey Ollie Adam Olsen Bryan Olson |