summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2025-02-08 15:06:05 +0800
committerSteve Sakoman <steve@sakoman.com>2025-02-15 06:04:44 -0800
commitbd51ce99cbba7a1efc0347470aef68966d9740ed (patch)
tree56baed6e71a1e110f823c10ecb0ecc9d22f83065
parent70b5e37d0df910ba0c0e90d4ae04f6390b8a925d (diff)
downloadpoky-bd51ce99cbba7a1efc0347470aef68966d9740ed.tar.gz
python3: Treat UID/GID overflow as failure
This fixes ptest failures on 32bit architectures AssertionError: Failed ptests: {'python3': ['test_extractall_none_gid', 'test_extractall_none_gname', 'test_extractall_none_mode', 'test_extractall_none_mtime', 'test_extractall_none_uid', 'test_extractall_none_uname', 'setUpClass', 'python3']} (From OE-Core rev: 838f3cff2a123fb7d5833b6760772ded6efb60bd) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 43104b547cb79693c83df0882773ae8dd74b1d35) Signed-off-by: Haixiao Yan <haixiao.yan.cn@windriver.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--meta/recipes-devtools/python/python3/0001-gh-107811-tarfile-treat-overflow-in-UID-GID-as-failu.patch40
-rw-r--r--meta/recipes-devtools/python/python3_3.10.16.bb1
2 files changed, 41 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python3/0001-gh-107811-tarfile-treat-overflow-in-UID-GID-as-failu.patch b/meta/recipes-devtools/python/python3/0001-gh-107811-tarfile-treat-overflow-in-UID-GID-as-failu.patch
new file mode 100644
index 0000000000..88b84c6024
--- /dev/null
+++ b/meta/recipes-devtools/python/python3/0001-gh-107811-tarfile-treat-overflow-in-UID-GID-as-failu.patch
@@ -0,0 +1,40 @@
1From 999d4e74d34afa233ad8ad0c70b989d77a21957f Mon Sep 17 00:00:00 2001
2From: Petr Viktorin <encukou@gmail.com>
3Date: Wed, 23 Aug 2023 20:00:07 +0200
4Subject: [PATCH] gh-107811: tarfile: treat overflow in UID/GID as failure to
5 set it (#108369)
6
7Upstream-Status: Backport [https://github.com/python/cpython/pull/108369]
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10 Lib/tarfile.py | 3 ++-
11 .../Library/2023-08-23-17-34-39.gh-issue-107811.3Fng72.rst | 3 +++
12 2 files changed, 5 insertions(+), 1 deletion(-)
13 create mode 100644 Misc/NEWS.d/next/Library/2023-08-23-17-34-39.gh-issue-107811.3Fng72.rst
14
15diff --git a/Lib/tarfile.py b/Lib/tarfile.py
16index 3bbbcaa..473167d 100755
17--- a/Lib/tarfile.py
18+++ b/Lib/tarfile.py
19@@ -2557,7 +2557,8 @@ class TarFile(object):
20 os.lchown(targetpath, u, g)
21 else:
22 os.chown(targetpath, u, g)
23- except OSError as e:
24+ except (OSError, OverflowError) as e:
25+ # OverflowError can be raised if an ID doesn't fit in `id_t`
26 raise ExtractError("could not change owner") from e
27
28 def chmod(self, tarinfo, targetpath):
29diff --git a/Misc/NEWS.d/next/Library/2023-08-23-17-34-39.gh-issue-107811.3Fng72.rst b/Misc/NEWS.d/next/Library/2023-08-23-17-34-39.gh-issue-107811.3Fng72.rst
30new file mode 100644
31index 0000000..ffca413
32--- /dev/null
33+++ b/Misc/NEWS.d/next/Library/2023-08-23-17-34-39.gh-issue-107811.3Fng72.rst
34@@ -0,0 +1,3 @@
35+:mod:`tarfile`: extraction of members with overly large UID or GID (e.g. on
36+an OS with 32-bit :c:type:`!id_t`) now fails in the same way as failing to
37+set the ID.
38--
392.45.0
40
diff --git a/meta/recipes-devtools/python/python3_3.10.16.bb b/meta/recipes-devtools/python/python3_3.10.16.bb
index 19a85a8770..48f845b089 100644
--- a/meta/recipes-devtools/python/python3_3.10.16.bb
+++ b/meta/recipes-devtools/python/python3_3.10.16.bb
@@ -36,6 +36,7 @@ SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \
36 file://deterministic_imports.patch \ 36 file://deterministic_imports.patch \
37 file://0001-Avoid-shebang-overflow-on-python-config.py.patch \ 37 file://0001-Avoid-shebang-overflow-on-python-config.py.patch \
38 file://0001-test_storlines-skip-due-to-load-variability.patch \ 38 file://0001-test_storlines-skip-due-to-load-variability.patch \
39 file://0001-gh-107811-tarfile-treat-overflow-in-UID-GID-as-failu.patch \
39 " 40 "
40 41
41SRC_URI:append:class-native = " \ 42SRC_URI:append:class-native = " \