Backported the build-time check for the getrandom syscall

..from Python 3.5.2.
The Python 3.5.1 build-time check was failing due to missing headers.

Resolves: rhbz#1350123
This commit is contained in:
Tomas Orsava 2016-09-16 18:56:17 +02:00
parent a3e9c34369
commit f833933af2
2 changed files with 74 additions and 1 deletions

View File

@ -0,0 +1,58 @@
From 7cedccf19a4a653b3e591928dc7b3d0e7d1ec50a Mon Sep 17 00:00:00 2001
From: Tomas Orsava <torsava@redhat.com>
Date: Fri, 16 Sep 2016 17:58:35 +0200
Subject: [PATCH] Updated the buildtime check for the getrandom syscall
to the one from Python version 3.5.2
---
configure | 6 ++++--
configure.ac | 6 ++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/configure b/configure
index 3a46658..f7f3717 100755
--- a/configure
+++ b/configure
@@ -16111,13 +16111,15 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
+ #include <unistd.h>
#include <sys/syscall.h>
+ #include <linux/random.h>
int main() {
char buffer[1];
const size_t buflen = sizeof(buffer);
- const int flags = 0;
- /* ignore the result, Python checks for ENOSYS at runtime */
+ const int flags = GRND_NONBLOCK;
+ /* ignore the result, Python checks for ENOSYS and EAGAIN at runtime */
(void)syscall(SYS_getrandom, buffer, buflen, flags);
return 0;
}
diff --git a/configure.ac b/configure.ac
index 05e067e..526688c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5168,13 +5168,15 @@ AC_MSG_CHECKING(for the Linux getrandom() syscall)
AC_LINK_IFELSE(
[
AC_LANG_SOURCE([[
+ #include <unistd.h>
#include <sys/syscall.h>
+ #include <linux/random.h>
int main() {
char buffer[1];
const size_t buflen = sizeof(buffer);
- const int flags = 0;
- /* ignore the result, Python checks for ENOSYS at runtime */
+ const int flags = GRND_NONBLOCK;
+ /* ignore the result, Python checks for ENOSYS and EAGAIN at runtime */
(void)syscall(SYS_getrandom, buffer, buflen, flags);
return 0;
}
--
2.9.0

View File

@ -112,7 +112,7 @@
Summary: Version 3 of the Python programming language aka Python 3000
Name: python3
Version: %{pybasever}.1
Release: 16%{?dist}
Release: 17%{?dist}
License: Python
Group: Development/Languages
@ -501,6 +501,15 @@ Patch241: 00241-CVE-2016-5636-buffer-overflow-in-zipimport-module-fix.patch
# Resolves: rhbz#1359177
Patch242: 00242-CVE-2016-1000110-httpoxy.patch
# 00246 #
# Backported the build-time check for the getrandom syscall from Python 3.5.2.
# The Python 3.5.1 build-time check was failing due to missing headers.
# Note: After rhbz#1377240 is resolved, the patch for the configure file
# can be omitted.
# Resolves: rhbz#1350123
Patch246: 00246-Updated-the-buildtime-check-for-the-getrandom-syscal.patch
# (New patches go here ^^^)
#
# When adding new patches to "python" and "python3" in Fedora, EL, etc.,
@ -768,6 +777,7 @@ sed -r -i s/'_PIP_VERSION = "[0-9.]+"'/'_PIP_VERSION = "%{pip_version}"'/ Lib/en
%patch237 -p1
%patch241 -p1
%patch242 -p1
%patch246 -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.
@ -1664,6 +1674,11 @@ rm -fr %{buildroot}
# ======================================================
%changelog
* Fri Sep 16 2016 Tomas Orsava <torsava@redhat.com> - 3.5.1-17
- Backported the build-time check for the getrandom syscall from Python 3.5.2
- The Python 3.5.1 build-time check was failing due to missing headers
- Resolves: rhbz#1350123
* Wed Sep 14 2016 Charalampos Stratakis <cstratak@redhat.com> - 3.5.1-16
- Obsolete and Provide python35 package