summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2024-01-24 16:05:24 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-01-27 08:20:03 +0000
commitcda5907dafea329774efb56dec32e5f91dd219e6 (patch)
tree8bfe408f05511c7e5fc46ec57a305f59afe2b4ae /meta/recipes-devtools/python
parentc4a9b044d85a802a3455f934e4bc9eeb33437df3 (diff)
downloadpoky-cda5907dafea329774efb56dec32e5f91dd219e6.tar.gz
python3: Initialize struct termios before calling tcgetattr()
Fixes ptest failures on python 3.12 Failed ptests: {'python3': ['test_tcgetattr', 'test_cfmakeraw', 'test_setcbreak', 'test_setraw', 'python3']} (From OE-Core rev: 515e7cf61c4ce5f6d572562ec851f01dade5cca0) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/python')
-rw-r--r--meta/recipes-devtools/python/python3/0001-gh-114492-Initialize-struct-termios-before-calling-t.patch42
-rw-r--r--meta/recipes-devtools/python/python3_3.12.1.bb1
2 files changed, 43 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python3/0001-gh-114492-Initialize-struct-termios-before-calling-t.patch b/meta/recipes-devtools/python/python3/0001-gh-114492-Initialize-struct-termios-before-calling-t.patch
new file mode 100644
index 0000000000..141b708a67
--- /dev/null
+++ b/meta/recipes-devtools/python/python3/0001-gh-114492-Initialize-struct-termios-before-calling-t.patch
@@ -0,0 +1,42 @@
1From bd0e1bf1504a5cba12133548bc49f1fcaf7b4da2 Mon Sep 17 00:00:00 2001
2From: "Miss Islington (bot)"
3 <31488909+miss-islington@users.noreply.github.com>
4Date: Tue, 23 Jan 2024 23:02:02 +0100
5Subject: [PATCH] gh-114492: Initialize struct termios before calling tcgetattr() (GH-114495) (GH-114502)
6
7On Alpine Linux it could leave some field non-initialized.
8(cherry picked from commit d22c066b802592932f9eb18434782299e80ca42e)
9
10Upstream-Status: Backport [https://github.com/python/cpython/commit/386c72d9928c51aa2c855ce592bd8022da3b407f]
11Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14 .../next/Library/2024-01-23-21-20-40.gh-issue-114492.vKxl5o.rst | 2 ++
15 Modules/termios.c | 2 ++
16 2 files changed, 4 insertions(+)
17 create mode 100644 Misc/NEWS.d/next/Library/2024-01-23-21-20-40.gh-issue-114492.vKxl5o.rst
18
19diff --git a/Misc/NEWS.d/next/Library/2024-01-23-21-20-40.gh-issue-114492.vKxl5o.rst b/Misc/NEWS.d/next/Library/2024-01-23-21-20-40.gh-issue-114492.vKxl5o.rst
20new file mode 100644
21index 0000000..8df8299
22--- /dev/null
23+++ b/Misc/NEWS.d/next/Library/2024-01-23-21-20-40.gh-issue-114492.vKxl5o.rst
24@@ -0,0 +1,2 @@
25+Make the result of :func:`termios.tcgetattr` reproducible on Alpine Linux.
26+Previously it could leave a random garbage in some fields.
27diff --git a/Modules/termios.c b/Modules/termios.c
28index c3d96cc..402e6ac 100644
29--- a/Modules/termios.c
30+++ b/Modules/termios.c
31@@ -84,6 +84,8 @@ termios_tcgetattr_impl(PyObject *module, int fd)
32 struct termios mode;
33 int r;
34
35+ /* Alpine Linux can leave some fields uninitialized. */
36+ memset(&mode, 0, sizeof(mode));
37 Py_BEGIN_ALLOW_THREADS
38 r = tcgetattr(fd, &mode);
39 Py_END_ALLOW_THREADS
40--
412.43.0
42
diff --git a/meta/recipes-devtools/python/python3_3.12.1.bb b/meta/recipes-devtools/python/python3_3.12.1.bb
index ece7539c51..1d3a4221c3 100644
--- a/meta/recipes-devtools/python/python3_3.12.1.bb
+++ b/meta/recipes-devtools/python/python3_3.12.1.bb
@@ -29,6 +29,7 @@ SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \
29 file://0001-Update-test_sysconfig-for-posix_user-purelib.patch \ 29 file://0001-Update-test_sysconfig-for-posix_user-purelib.patch \
30 file://0001-skip-no_stdout_fileno-test-due-to-load-variability.patch \ 30 file://0001-skip-no_stdout_fileno-test-due-to-load-variability.patch \
31 file://0001-test_storlines-skip-due-to-load-variability.patch \ 31 file://0001-test_storlines-skip-due-to-load-variability.patch \
32 file://0001-gh-114492-Initialize-struct-termios-before-calling-t.patch \
32 " 33 "
33 34
34SRC_URI:append:class-native = " \ 35SRC_URI:append:class-native = " \