From 03ab356cb4e6952fef1e5a02421f10da8d1c05e3 Mon Sep 17 00:00:00 2001 From: Andy Postnikov Date: Tue, 23 Jan 2024 22:01:41 +0100 Subject: [PATCH] main/python3: add patch for termios --- main/python3/114495-fix-termios.patch | 35 +++++++++++++++++++++++++++ main/python3/APKBUILD | 7 +++--- 2 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 main/python3/114495-fix-termios.patch diff --git a/main/python3/114495-fix-termios.patch b/main/python3/114495-fix-termios.patch new file mode 100644 index 00000000000..8b040161ee4 --- /dev/null +++ b/main/python3/114495-fix-termios.patch @@ -0,0 +1,35 @@ +Patch-Source: https://github.com/python/cpython/pull/114495 +From 7f059373349d6e9e6504b2957e09921642aaacde Mon Sep 17 00:00:00 2001 +From: Serhiy Storchaka +Date: Tue, 23 Jan 2024 21:20:54 +0200 +Subject: [PATCH] gh-114492: Initialize struct termios before calling + tcgetattr() + +On Alpine Linux it could leave some field non-initialized. +--- + .../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 00000000000000..8df8299d0dffcd +--- /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 c4f0fd9d50044a..69dbd88be5fcc2 100644 +--- a/Modules/termios.c ++++ b/Modules/termios.c +@@ -98,6 +98,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 diff --git a/main/python3/APKBUILD b/main/python3/APKBUILD index 70f8eeb4614..a5ab9c56fa1 100644 --- a/main/python3/APKBUILD +++ b/main/python3/APKBUILD @@ -4,7 +4,7 @@ pkgname=python3 # the python3-tkinter's pkgver needs to be synchronized with this. pkgver=3.11.7 _basever="${pkgver%.*}" -pkgrel=0 +pkgrel=1 pkgdesc="High-level scripting language" url="https://www.python.org/" arch="all" @@ -43,6 +43,7 @@ makedepends=" source="https://www.python.org/ftp/python/$pkgver/Python-$pkgver.tar.xz externally-managed musl-find_library.patch + 114495-fix-termios.patch " options="net" # Required for tests builddir="$srcdir/Python-$pkgver" @@ -179,9 +180,6 @@ EOF # kernel related fail="$fail test_fcntl" # wants DNOTIFY, we don't have it - # since 3.11.7 https://github.com/python/cpython/issues/114492 - fail="$fail test_termios" - case "$CARCH" in ppc64le) fail="$fail test_buffer" @@ -277,4 +275,5 @@ sha512sums=" 11e06f2ffe1f66888cb5b4e9f607de815294d6863a77eda6ec6d7c724ef158df9f51881f4a956d4a6fa973c2fb6fd031d495e3496e9b0bb53793fb1cc8434c63 Python-3.11.7.tar.xz 46dd8230ee2ab66e9c4157c10b2bd9c414fd7f30be0bee73e21a9eea88f63fff362d47828e0fc77ddc59df097b414b21505f8b5f98bc866381115c58ae3f4862 externally-managed ab8eaa2858d5109049b1f9f553198d40e0ef8d78211ad6455f7b491af525bffb16738fed60fc84e960c4889568d25753b9e4a1494834fea48291b33f07000ec2 musl-find_library.patch +f9e70676e1f9cee1869111e5add632221c41259c515a4b7edcd0e3c4aa7d6140468554927cf31bfd014c794ae2fbf7ceb569d30cc6fac6d3870923486ba10c88 114495-fix-termios.patch "