Fix multiprocessing regression on newer glibcs

Enable test_multiprocessing_fork(server) and _spawn again

Resolves: rhbz#1569933
This commit is contained in:
Miro Hrončok 2018-04-23 21:13:08 +02:00
parent ee04c1b4b6
commit 712f3838b8
2 changed files with 68 additions and 7 deletions

View File

@ -0,0 +1,55 @@
From a3febe3cba14b89885f42ca2f0224096a52885f6 Mon Sep 17 00:00:00 2001
From: Antoine Pitrou <antoine@python.org>
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;

View File

@ -98,7 +98,7 @@
Summary: Version 3.5 of the Python programming language
Name: python%{pyshortver}
Version: %{pybasever}.5
Release: 1%{?dist}
Release: 2%{?dist}
License: Python
Group: Development/Languages
@ -393,6 +393,12 @@ Patch273: 00273-skip-float-test.patch
# Fixed upstream: https://bugs.python.org/issue32635
Patch290: 00290-cryptmodule-Include-crypt.h-for-declaration-of-crypt.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.,
@ -507,6 +513,7 @@ rm -r Modules/zlib || exit 1
%patch270 -p1
%patch273 -p1
%patch290 -p1
%patch302 -p1
# Currently (2010-01-15), http://docs.python.org/library is for 2.6, and there
# are many differences between 2.6 and the Python 3 library.
@ -943,12 +950,6 @@ CheckPython() {
%ifarch %{power64} s390 s390x armv7hl aarch64 %{mips}
-x test_gdb \
%endif
-x test_multiprocessing_fork \
-x test_multiprocessing_forkserver \
-x test_multiprocessing_spawn \
%ifnarch %{ix86} x86_64
-x test_rapid_restart \
%endif
echo FINISHED: CHECKING OF PYTHON FOR CONFIGURATION: $ConfName
@ -1041,6 +1042,11 @@ CheckPython optimized
# ======================================================
%changelog
* Mon Apr 23 2018 Miro Hrončok <mhroncok@redhat.com> - 3.5.5-2
- Fix multiprocessing regression on newer glibcs
- Enable test_multiprocessing_fork(server) and _spawn again
Resolves: rhbz#1569933
* Fri Apr 20 2018 Miro Hrončok <mhroncok@redhat.com> - 3.5.5-1
- Rebased to version 3.5.5
- Do not ship the Tools directory