Message ID | 20250208070605.3478960-1-haixiao.yan.cn@eng.windriver.com |
---|---|
State | Accepted, archived |
Commit | 838f3cff2a123fb7d5833b6760772ded6efb60bd |
Delegated to: | Steve Sakoman |
Headers | show |
Series | [kirkstone,1/1] python3: Treat UID/GID overflow as failure | expand |
Pls ignore this patch. Upstream-Status: Backport [https://github.com/python/cpython/pull/108369] need to be update. Thanks, Haixiao On 2025/2/8 15:06, haixiao.yan.cn via lists.openembedded.org wrote: > From: Khem Raj <raj.khem@gmail.com> > > 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']} > > 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> > --- > ...e-treat-overflow-in-UID-GID-as-failu.patch | 40 +++++++++++++++++++ > .../python/python3_3.10.16.bb | 1 + > 2 files changed, 41 insertions(+) > create mode 100644 meta/recipes-devtools/python/python3/0001-gh-107811-tarfile-treat-overflow-in-UID-GID-as-failu.patch > > 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 000000000000..88b84c602435 > --- /dev/null > +++ b/meta/recipes-devtools/python/python3/0001-gh-107811-tarfile-treat-overflow-in-UID-GID-as-failu.patch > @@ -0,0 +1,40 @@ > +From 999d4e74d34afa233ad8ad0c70b989d77a21957f Mon Sep 17 00:00:00 2001 > +From: Petr Viktorin <encukou@gmail.com> > +Date: Wed, 23 Aug 2023 20:00:07 +0200 > +Subject: [PATCH] gh-107811: tarfile: treat overflow in UID/GID as failure to > + set it (#108369) > + > +Upstream-Status: Backport [https://github.com/python/cpython/pull/108369] > +Signed-off-by: Khem Raj <raj.khem@gmail.com> > +--- > + Lib/tarfile.py | 3 ++- > + .../Library/2023-08-23-17-34-39.gh-issue-107811.3Fng72.rst | 3 +++ > + 2 files changed, 5 insertions(+), 1 deletion(-) > + create mode 100644 Misc/NEWS.d/next/Library/2023-08-23-17-34-39.gh-issue-107811.3Fng72.rst > + > +diff --git a/Lib/tarfile.py b/Lib/tarfile.py > +index 3bbbcaa..473167d 100755 > +--- a/Lib/tarfile.py > ++++ b/Lib/tarfile.py > +@@ -2557,7 +2557,8 @@ class TarFile(object): > + os.lchown(targetpath, u, g) > + else: > + os.chown(targetpath, u, g) > +- except OSError as e: > ++ except (OSError, OverflowError) as e: > ++ # OverflowError can be raised if an ID doesn't fit in `id_t` > + raise ExtractError("could not change owner") from e > + > + def chmod(self, tarinfo, targetpath): > +diff --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 > +new file mode 100644 > +index 0000000..ffca413 > +--- /dev/null > ++++ b/Misc/NEWS.d/next/Library/2023-08-23-17-34-39.gh-issue-107811.3Fng72.rst > +@@ -0,0 +1,3 @@ > ++:mod:`tarfile`: extraction of members with overly large UID or GID (e.g. on > ++an OS with 32-bit :c:type:`!id_t`) now fails in the same way as failing to > ++set the ID. > +-- > +2.45.0 > + > diff --git a/meta/recipes-devtools/python/python3_3.10.16.bb b/meta/recipes-devtools/python/python3_3.10.16.bb > index 19a85a8770c4..48f845b0891a 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 \ > file://deterministic_imports.patch \ > file://0001-Avoid-shebang-overflow-on-python-config.py.patch \ > file://0001-test_storlines-skip-due-to-load-variability.patch \ > + file://0001-gh-107811-tarfile-treat-overflow-in-UID-GID-as-failu.patch \ > " > > SRC_URI:append:class-native = " \ > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#211019): https://lists.openembedded.org/g/openembedded-core/message/211019 > Mute This Topic: https://lists.openembedded.org/mt/111067807/8599992 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [Haixiao.Yan.CN@windriver.com] > -=-=-=-=-=-=-=-=-=-=-=- >
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 000000000000..88b84c602435 --- /dev/null +++ b/meta/recipes-devtools/python/python3/0001-gh-107811-tarfile-treat-overflow-in-UID-GID-as-failu.patch @@ -0,0 +1,40 @@ +From 999d4e74d34afa233ad8ad0c70b989d77a21957f Mon Sep 17 00:00:00 2001 +From: Petr Viktorin <encukou@gmail.com> +Date: Wed, 23 Aug 2023 20:00:07 +0200 +Subject: [PATCH] gh-107811: tarfile: treat overflow in UID/GID as failure to + set it (#108369) + +Upstream-Status: Backport [https://github.com/python/cpython/pull/108369] +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + Lib/tarfile.py | 3 ++- + .../Library/2023-08-23-17-34-39.gh-issue-107811.3Fng72.rst | 3 +++ + 2 files changed, 5 insertions(+), 1 deletion(-) + create mode 100644 Misc/NEWS.d/next/Library/2023-08-23-17-34-39.gh-issue-107811.3Fng72.rst + +diff --git a/Lib/tarfile.py b/Lib/tarfile.py +index 3bbbcaa..473167d 100755 +--- a/Lib/tarfile.py ++++ b/Lib/tarfile.py +@@ -2557,7 +2557,8 @@ class TarFile(object): + os.lchown(targetpath, u, g) + else: + os.chown(targetpath, u, g) +- except OSError as e: ++ except (OSError, OverflowError) as e: ++ # OverflowError can be raised if an ID doesn't fit in `id_t` + raise ExtractError("could not change owner") from e + + def chmod(self, tarinfo, targetpath): +diff --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 +new file mode 100644 +index 0000000..ffca413 +--- /dev/null ++++ b/Misc/NEWS.d/next/Library/2023-08-23-17-34-39.gh-issue-107811.3Fng72.rst +@@ -0,0 +1,3 @@ ++:mod:`tarfile`: extraction of members with overly large UID or GID (e.g. on ++an OS with 32-bit :c:type:`!id_t`) now fails in the same way as failing to ++set the ID. +-- +2.45.0 + diff --git a/meta/recipes-devtools/python/python3_3.10.16.bb b/meta/recipes-devtools/python/python3_3.10.16.bb index 19a85a8770c4..48f845b0891a 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 \ file://deterministic_imports.patch \ file://0001-Avoid-shebang-overflow-on-python-config.py.patch \ file://0001-test_storlines-skip-due-to-load-variability.patch \ + file://0001-gh-107811-tarfile-treat-overflow-in-UID-GID-as-failu.patch \ " SRC_URI:append:class-native = " \