Add patch to explicitly link _ctypes module with -ldl (#1537489)

Refactored patch for libxcrypt
Re-enable strict symbol checks in the link editor
This commit is contained in:
Björn Esser 2018-01-23 15:25:04 +01:00
parent 5a8bf97593
commit ce6ec4f16a
No known key found for this signature in database
GPG Key ID: F52E98007594C21D
3 changed files with 54 additions and 24 deletions

View File

@ -1,4 +1,4 @@
From 6811089dbf34a2cef9799e1cb6d63b863b58739f Mon Sep 17 00:00:00 2001
From bb9a8332e54fd6d2b0d4767b55c7df9a36ad3022 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= <besser82@fedoraproject.org>
Date: Sun, 21 Jan 2018 18:55:31 +0100
Subject: [PATCH] cryptmodule: Include <crypt.h> for declaration of crypt() if
@ -9,18 +9,18 @@ and may use an external or replacement library, like libxcrypt, for
providing such functions.
---
Modules/_cryptmodule.c | 4 ++++
configure.ac | 4 ++++
2 files changed, 8 insertions(+)
configure.ac | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/Modules/_cryptmodule.c b/Modules/_cryptmodule.c
index 58d179e6a3..bb26d83f55 100644
index 58d179e6a3..0031037b64 100644
--- a/Modules/_cryptmodule.c
+++ b/Modules/_cryptmodule.c
@@ -5,6 +5,10 @@
#include <sys/types.h>
+#if defined(HAVE_XCRYPT)
+#if defined(HAVE_CRYPT_H)
+#include <crypt.h>
+#endif
+
@ -28,20 +28,18 @@ index 58d179e6a3..bb26d83f55 100644
/*[clinic input]
diff --git a/configure.ac b/configure.ac
index 39e2e8e769..129c198c15 100644
index 39e2e8e769..79397a7a24 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2816,6 +2816,10 @@ LIBS="$withval $LIBS"
PKG_PROG_PKG_CONFIG
+# Check for libxcrypt is present.
+PKG_CHECK_MODULES([libxcrypt], libxcrypt,
+ AC_DEFINE([HAVE_XCRYPT], 1, [Define to 1 if libxcrypt is found.]), [])
+
# Check for use of the system expat library
AC_MSG_CHECKING(for --with-system-expat)
AC_ARG_WITH(system_expat,
@@ -2049,7 +2049,7 @@ AC_CHECK_HEADERS(asm/types.h conio.h direct.h dlfcn.h errno.h \
fcntl.h grp.h \
ieeefp.h io.h langinfo.h libintl.h process.h pthread.h \
sched.h shadow.h signal.h stropts.h termios.h \
-unistd.h utime.h \
+unistd.h crypt.h utime.h \
poll.h sys/devpoll.h sys/epoll.h sys/poll.h \
sys/audioio.h sys/xattr.h sys/bsdtty.h sys/event.h sys/file.h sys/ioctl.h \
sys/kern_control.h sys/loadavg.h sys/lock.h sys/mkdev.h sys/modem.h \
--
2.16.0
2.16.1

View File

@ -0,0 +1,25 @@
From aae2ef0bace0e38f4ee5aaa4642aa32450a84216 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= <besser82@fedoraproject.org>
Date: Tue, 23 Jan 2018 14:43:43 +0100
Subject: [PATCH] setup: Link ctypes against dl explicitly
---
setup.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.py b/setup.py
index c23628a2a9..9e40bb53e6 100644
--- a/setup.py
+++ b/setup.py
@@ -1935,7 +1935,7 @@ class PyBuildExt(build_ext):
self.use_system_libffi = False
include_dirs = []
extra_compile_args = []
- extra_link_args = []
+ extra_link_args = ['-ldl']
sources = ['_ctypes/_ctypes.c',
'_ctypes/callbacks.c',
'_ctypes/callproc.c',
--
2.16.1

View File

@ -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}.4
Release: 7%{?dist}
Release: 8%{?dist}
License: Python
@ -146,11 +146,6 @@ License: Python
# on files that test invalid syntax.
%undefine py_auto_byte_compile
# Disable strict symbol checks in the link editor.
# See: https://src.fedoraproject.org/rpms/redhat-rpm-config/c/078af192613e1beec34824a94dc5f6feeeea1568?branch=master
# https://bugzilla.redhat.com/show_bug.cgi?id=1537489
%undefine _strict_symbol_defs_build
# For multilib support, files that are different between 32- and 64-bit arches
# need different filenames. Use "64" or "32" according to the word size.
# Currently, the best way to determine an architecture's word size happens to
@ -371,6 +366,12 @@ Patch289: 00289-fix-nis-compilation.patch
# Reported upstream: https://bugs.python.org/issue32635
Patch290: 00290-cryptmodule-Include-crypt.h-for-declaration-of-crypt.patch
# 00291 #
# Build fails with undefined references to dlopen / dlsym otherwise.
# See: https://bugzilla.redhat.com/show_bug.cgi?id=1537489
# and: https://src.fedoraproject.org/rpms/redhat-rpm-config/c/078af19
Patch291: 00291-setup-Link-ctypes-against-dl-explicitly.patch
# (New patches go here ^^^)
#
# When adding new patches to "python" and "python3" in Fedora, EL, etc.,
@ -638,6 +639,7 @@ sed -r -i s/'_PIP_VERSION = "[0-9.]+"'/'_PIP_VERSION = "%{pip_version}"'/ Lib/en
%patch274 -p1
%patch289 -p1
%patch290 -p1
%patch291 -p1
# Remove files that should be generated by the build
@ -1502,6 +1504,11 @@ fi
# ======================================================
%changelog
* Tue Jan 23 2018 Björn Esser <besser82@fedoraproject.org> - 3.6.4-8
- Add patch to explicitly link _ctypes module with -ldl (#1537489)
- Refactored patch for libxcrypt
- Re-enable strict symbol checks in the link editor
* Mon Jan 22 2018 Björn Esser <besser82@fedoraproject.org> - 3.6.4-7
- Add patch for libxcrypt
- Disable strict symbol checks in the link editor