From e324bf2dbba4dd776d787a8f124676a5e44c94d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Mon, 23 Apr 2018 18:17:32 +0200 Subject: [PATCH] Fix multiprocessing regression on newer glibcs Enable test_multiprocessing_fork(server) and _spawn again Resolves: rhbz#1569933 --- ...rocessing-regression-on-newer-glibcs.patch | 55 +++++++++++++++++++ python3.spec | 17 ++++-- 2 files changed, 68 insertions(+), 4 deletions(-) create mode 100644 00302-fix-multiprocessing-regression-on-newer-glibcs.patch diff --git a/00302-fix-multiprocessing-regression-on-newer-glibcs.patch b/00302-fix-multiprocessing-regression-on-newer-glibcs.patch new file mode 100644 index 0000000..965792a --- /dev/null +++ b/00302-fix-multiprocessing-regression-on-newer-glibcs.patch @@ -0,0 +1,55 @@ +From a3febe3cba14b89885f42ca2f0224096a52885f6 Mon Sep 17 00:00:00 2001 +From: Antoine Pitrou +Date: Mon, 23 Apr 2018 13:19:42 +0200 +Subject: [PATCH] bpo-33329: Fix multiprocessing regression on newer glibcs + +Starting with glibc 2.27.9000-xxx, sigaddset() can return EINVAL for some +reserved signal numbers between 1 and NSIG. The `range(1, NSIG)` idiom +is commonly used to select all signals for blocking with `pthread_sigmask`. +So we ignore the sigaddset() return value until we expose sigfillset() +to provide a better idiom. +--- + .../next/Library/2018-04-23-13-21-39.bpo-33329.lQ-Eod.rst | 1 + + Modules/signalmodule.c | 14 ++++++++------ + 2 files changed, 9 insertions(+), 6 deletions(-) + create mode 100644 Misc/NEWS.d/next/Library/2018-04-23-13-21-39.bpo-33329.lQ-Eod.rst + +diff --git a/Misc/NEWS.d/next/Library/2018-04-23-13-21-39.bpo-33329.lQ-Eod.rst b/Misc/NEWS.d/next/Library/2018-04-23-13-21-39.bpo-33329.lQ-Eod.rst +new file mode 100644 +index 000000000000..d1a4e56d04b9 +--- /dev/null ++++ b/Misc/NEWS.d/next/Library/2018-04-23-13-21-39.bpo-33329.lQ-Eod.rst +@@ -0,0 +1 @@ ++Fix multiprocessing regression on newer glibcs +diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c +index 791616014384..35fd87e2d1e7 100644 +--- a/Modules/signalmodule.c ++++ b/Modules/signalmodule.c +@@ -819,7 +819,6 @@ iterable_to_sigset(PyObject *iterable, sigset_t *mask) + int result = -1; + PyObject *iterator, *item; + long signum; +- int err; + + sigemptyset(mask); + +@@ -841,11 +840,14 @@ iterable_to_sigset(PyObject *iterable, sigset_t *mask) + Py_DECREF(item); + if (signum == -1 && PyErr_Occurred()) + goto error; +- if (0 < signum && signum < NSIG) +- err = sigaddset(mask, (int)signum); +- else +- err = 1; +- if (err) { ++ if (0 < signum && signum < NSIG) { ++ /* bpo-33329: ignore sigaddset() return value as it can fail ++ * for some reserved signals, but we want the `range(1, NSIG)` ++ * idiom to allow selecting all valid signals. ++ */ ++ (void) sigaddset(mask, (int)signum); ++ } ++ else { + PyErr_Format(PyExc_ValueError, + "signal number %ld out of range", signum); + goto error; diff --git a/python3.spec b/python3.spec index a69624d..a81b111 100644 --- a/python3.spec +++ b/python3.spec @@ -14,7 +14,7 @@ URL: https://www.python.org/ # WARNING When rebasing to a new Python version, # remember to update the python3-docs package as well Version: %{pybasever}.5 -Release: 3%{?dist} +Release: 4%{?dist} License: Python @@ -374,6 +374,12 @@ Patch294: 00294-define-TLS-cipher-suite-on-build-time.patch # Fixed upstream: https://bugs.python.org/issue32885 Patch301: 00301-pathfix-add-n-option-for-no-backup.patch +# 00302 # +# Fix multiprocessing regression on newer glibcs +# See: https://bugzilla.redhat.com/show_bug.cgi?id=1569933 +# and: https://bugs.python.org/issue33329 +Patch302: 00302-fix-multiprocessing-regression-on-newer-glibcs.patch + # (New patches go here ^^^) # # When adding new patches to "python" and "python3" in Fedora, EL, etc., @@ -691,6 +697,7 @@ sed -r -i s/'_PIP_VERSION = "[0-9.]+"'/'_PIP_VERSION = "%{pip_version}"'/ Lib/en %patch292 -p1 %patch294 -p1 %patch301 -p1 +%patch302 -p1 # Remove files that should be generated by the build @@ -1093,9 +1100,6 @@ CheckPython() { %ifarch ppc64le -x test_buffer \ %endif - -x test_multiprocessing_fork \ - -x test_multiprocessing_forkserver \ - -x test_multiprocessing_spawn \ echo FINISHED: CHECKING OF PYTHON FOR CONFIGURATION: $ConfName @@ -1582,6 +1586,11 @@ CheckPython optimized # ====================================================== %changelog +* Mon Apr 23 2018 Miro Hrončok - 3.6.5-4 +- Fix multiprocessing regression on newer glibcs +- Enable test_multiprocessing_fork(server) and _spawn again +Resolves: rhbz#1569933 + * Thu Apr 19 2018 Miro Hrončok - 3.6.5-3 - Skip test_multiprocessing_fork(server) and _spawn for now