public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Khem Raj <raj.khem@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Khem Raj <raj.khem@gmail.com>
Subject: [PATCH] python3: Initialize struct termios before calling tcgetattr()
Date: Wed, 24 Jan 2024 16:05:24 -0800	[thread overview]
Message-ID: <20240125000524.2245253-1-raj.khem@gmail.com> (raw)

Fixes ptest failures on python 3.12

    Failed ptests:
    {'python3': ['test_tcgetattr',
                 'test_cfmakeraw',
                 'test_setcbreak',
                 'test_setraw',
                 'python3']}

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...lize-struct-termios-before-calling-t.patch | 42 +++++++++++++++++++
 .../recipes-devtools/python/python3_3.12.1.bb |  1 +
 2 files changed, 43 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3/0001-gh-114492-Initialize-struct-termios-before-calling-t.patch

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 00000000000..141b708a678
--- /dev/null
+++ b/meta/recipes-devtools/python/python3/0001-gh-114492-Initialize-struct-termios-before-calling-t.patch
@@ -0,0 +1,42 @@
+From bd0e1bf1504a5cba12133548bc49f1fcaf7b4da2 Mon Sep 17 00:00:00 2001
+From: "Miss Islington (bot)"
+ <31488909+miss-islington@users.noreply.github.com>
+Date: Tue, 23 Jan 2024 23:02:02 +0100
+Subject: [PATCH] gh-114492: Initialize struct termios before calling tcgetattr() (GH-114495) (GH-114502)
+
+On Alpine Linux it could leave some field non-initialized.
+(cherry picked from commit d22c066b802592932f9eb18434782299e80ca42e)
+
+Upstream-Status: Backport [https://github.com/python/cpython/commit/386c72d9928c51aa2c855ce592bd8022da3b407f]
+Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ .../next/Library/2024-01-23-21-20-40.gh-issue-114492.vKxl5o.rst | 2 ++
+ Modules/termios.c                                               | 2 ++
+ 2 files changed, 4 insertions(+)
+ create mode 100644 Misc/NEWS.d/next/Library/2024-01-23-21-20-40.gh-issue-114492.vKxl5o.rst
+
+diff --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
+new file mode 100644
+index 0000000..8df8299
+--- /dev/null
++++ b/Misc/NEWS.d/next/Library/2024-01-23-21-20-40.gh-issue-114492.vKxl5o.rst
+@@ -0,0 +1,2 @@
++Make the result of :func:`termios.tcgetattr` reproducible on Alpine Linux.
++Previously it could leave a random garbage in some fields.
+diff --git a/Modules/termios.c b/Modules/termios.c
+index c3d96cc..402e6ac 100644
+--- a/Modules/termios.c
++++ b/Modules/termios.c
+@@ -84,6 +84,8 @@ termios_tcgetattr_impl(PyObject *module, int fd)
+     struct termios mode;
+     int r;
+ 
++    /* Alpine Linux can leave some fields uninitialized. */
++    memset(&mode, 0, sizeof(mode));
+     Py_BEGIN_ALLOW_THREADS
+     r = tcgetattr(fd, &mode);
+     Py_END_ALLOW_THREADS
+-- 
+2.43.0
+
diff --git a/meta/recipes-devtools/python/python3_3.12.1.bb b/meta/recipes-devtools/python/python3_3.12.1.bb
index ece7539c51d..1d3a4221c32 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 \
            file://0001-Update-test_sysconfig-for-posix_user-purelib.patch \
            file://0001-skip-no_stdout_fileno-test-due-to-load-variability.patch \
            file://0001-test_storlines-skip-due-to-load-variability.patch \
+           file://0001-gh-114492-Initialize-struct-termios-before-calling-t.patch \
            "
 
 SRC_URI:append:class-native = " \
-- 
2.43.0



                 reply	other threads:[~2024-01-25  0:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240125000524.2245253-1-raj.khem@gmail.com \
    --to=raj.khem@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox