From 026b07928dbc75c099ba964cb9f10acecc311f6d Mon Sep 17 00:00:00 2001 From: Richard Lescak Date: Fri, 25 Feb 2022 14:57:47 +0100 Subject: [PATCH] use Python LIBS instead of LDFLAGS - fix annocheck issues Resolves: rhbz#2051211 --- ...config-python-module-in-python_devel.patch | 131 ++++++++++++++++-- ...YTHON_LIBS-instead-of-PYTHON_LDFLAGS.patch | 32 +++++ ldns.spec | 7 +- 3 files changed, 154 insertions(+), 16 deletions(-) create mode 100644 ldns-1.7.1-Use-PYTHON_LIBS-instead-of-PYTHON_LDFLAGS.patch diff --git a/ldns-1.7.1-Support-sysconfig-python-module-in-python_devel.patch b/ldns-1.7.1-Support-sysconfig-python-module-in-python_devel.patch index bb3f395..e6b2ccf 100644 --- a/ldns-1.7.1-Support-sysconfig-python-module-in-python_devel.patch +++ b/ldns-1.7.1-Support-sysconfig-python-module-in-python_devel.patch @@ -1,7 +1,51 @@ -diff -urN a/ldns-1.7.1/ax_python_devel.m4 b/ldns-1.7.1/ax_python_devel.m4 ---- a/ldns-1.7.1/ax_python_devel.m4 2019-07-26 17:07:44.000000000 +0200 -+++ b/ldns-1.7.1/ax_python_devel.m4 2022-02-15 12:35:30.881489085 +0100 -@@ -135,16 +135,24 @@ +--- a/m4/ax_python_devel.m4 2019-07-26 17:07:44.000000000 +0200 ++++ b/m4/ax_python_devel.m4 2022-02-15 10:29:28.876543000 +0100 +@@ -1,5 +1,5 @@ + # =========================================================================== +-# http://www.gnu.org/software/autoconf-archive/ax_python_devel.html ++# https://www.gnu.org/software/autoconf-archive/ax_python_devel.html + # =========================================================================== + # + # SYNOPSIS +@@ -12,8 +12,8 @@ + # in your configure.ac. + # + # This macro checks for Python and tries to get the include path to +-# 'Python.h'. It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LDFLAGS) +-# output variables. It also exports $(PYTHON_EXTRA_LIBS) and ++# 'Python.h'. It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LIBS) output ++# variables. It also exports $(PYTHON_EXTRA_LIBS) and + # $(PYTHON_EXTRA_LDFLAGS) for embedding Python in your code. + # + # You can search for some particular version of Python by passing a +@@ -52,7 +52,7 @@ + # Public License for more details. + # + # You should have received a copy of the GNU General Public License along +-# with this program. If not, see . ++# with this program. If not, see . + # + # As a special exception, the respective Autoconf Macro's copyright owner + # gives unlimited permission to copy, distribute and modify the configure +@@ -67,7 +67,7 @@ + # modified version of the Autoconf Macro, you may extend this special + # exception to the GPL to apply to your modified version as well. + +-#serial 16 ++#serial 23 + + AU_ALIAS([AC_PYTHON_DEVEL], [AX_PYTHON_DEVEL]) + AC_DEFUN([AX_PYTHON_DEVEL],[ +@@ -99,7 +99,7 @@ + This version of the AC@&t@_PYTHON_DEVEL macro + doesn't work properly with versions of Python before + 2.1.0. You may need to re-run configure, setting the +-variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG, ++variables PYTHON_CPPFLAGS, PYTHON_LIBS, PYTHON_SITE_PKG, + PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand. + Moreover, to disable this check, set PYTHON_NOVERSIONCHECK + to something else than an empty string. +@@ -135,16 +135,25 @@ # # Check if you have distutils, else fail # @@ -16,6 +60,7 @@ diff -urN a/ldns-1.7.1/ax_python_devel.m4 b/ldns-1.7.1/ax_python_devel.m4 else AC_MSG_RESULT([no]) - AC_MSG_ERROR([cannot import Python module "distutils". ++ + AC_MSG_CHECKING([for the distutils Python package]) + ac_sysconfig_result=`$PYTHON -c "from distutils import sysconfig" 2>&1` + if test $? -eq 0; then @@ -32,7 +77,7 @@ diff -urN a/ldns-1.7.1/ax_python_devel.m4 b/ldns-1.7.1/ax_python_devel.m4 fi # -@@ -152,10 +160,19 @@ +@@ -152,10 +161,19 @@ # AC_MSG_CHECKING([for Python include path]) if test -z "$PYTHON_CPPFLAGS"; then @@ -56,7 +101,15 @@ diff -urN a/ldns-1.7.1/ax_python_devel.m4 b/ldns-1.7.1/ax_python_devel.m4 if test -n "${python_path}"; then if test "${plat_python_path}" != "${python_path}"; then python_path="-I$python_path -I$plat_python_path" -@@ -179,7 +196,7 @@ +@@ -172,14 +190,14 @@ + # Check for Python library path + # + AC_MSG_CHECKING([for Python library path]) +- if test -z "$PYTHON_LDFLAGS"; then ++ if test -z "$PYTHON_LIBS"; then + # (makes two attempts to ensure we've got a version number + # from the interpreter) + ac_python_version=`cat< +Date: Thu, 3 Jun 2021 10:51:15 +0200 +Subject: [PATCH] Use PYTHON_LIBS instead of PYTHON_LDFLAGS + +Definition was changed to more obvious variable in ax_python_devel.m4 +--- + Makefile.in | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/ldns-1.7.1/Makefile.in b/ldns-1.7.1/Makefile.in +index af529e43..2f6b1423 100644 +--- a/ldns-1.7.1/Makefile.in ++++ b/ldns-1.7.1/Makefile.in +@@ -48,7 +48,7 @@ LIBS = @LIBS@ + LIBOBJDIR = compat/ + LIBOBJS = @LIBOBJS@ + PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ +-PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ ++PYTHON_LIBS = @PYTHON_LIBS@ + PYTHON_X_CFLAGS = @PYTHON_X_CFLAGS@ + LIBSSL_CPPFLAGS = @LIBSSL_CPPFLAGS@ + LIBSSL_LDFLAGS = @LIBSSL_LDFLAGS@ +@@ -301,7 +301,7 @@ + $(COMP_LIB) -I./include/ldns $(LIBSSL_CPPFLAGS) $(PYTHON_CPPFLAGS) $(PYTHON_X_CFLAGS) -c $(pywrapdir)/ldns_wrapper.c -o $@ + + _ldns.la: ldns_wrapper.lo libldns.la +- $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(PYTHON_CFLAGS) $(LDFLAGS) $(PYTHON_LDFLAGS) -module -version-info $(version_info) -no-undefined -o $@ ldns_wrapper.lo -rpath $(python_site) -L. -L.libs -lldns $(LIBS) ++ $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(PYTHON_CFLAGS) $(LDFLAGS) -module -version-info $(version_info) -no-undefined -o $@ ldns_wrapper.lo -rpath $(python_site) -L. -L.libs -lldns $(PYTHON_LIBS) $(LIBS) + + $(p5_dns_ldns_dir)/Makefile: $(p5_dns_ldns_dir)/Makefile.PL + BUILDDIR=`pwd`; cd $(p5_dns_ldns_dir); LD_LIBRARY_PATH="$$BUILDDIR/.libs:$$LD_LIBRARY_PATH" DYLD_LIBRARY_PATH="$$BUILDDIR/.libs:$$DYLD_LIBRARY_PATH" $(PERL) Makefile.PL LIBS="-L$$BUILDDIR/.libs -lldns" INC="-I$$BUILDDIR" diff --git a/ldns.spec b/ldns.spec index 191dde4..ddc15c6 100644 --- a/ldns.spec +++ b/ldns.spec @@ -39,7 +39,7 @@ Summary: Low-level DNS(SEC) library with API Name: ldns Version: 1.7.1 -Release: 9%{?dist} +Release: 10%{?dist} License: BSD Url: https://www.nlnetlabs.nl/%{name}/ @@ -55,6 +55,8 @@ Patch3: ldns-1.7.1-out-of-boud-read-vuln.patch # https://github.com/autoconf-archive/autoconf-archive/commit/7f21e125bbe4e7c93d3bc86cda29c8b8e3b07d52 # used 'platlib' instead of 'purelib' Patch4: ldns-1.7.1-Support-sysconfig-python-module-in-python_devel.patch +# https://github.com/NLnetLabs/ldns/commit/a5a5dd867fdb934a7ce3637dd9def598f0979247 +Patch5: ldns-1.7.1-Use-PYTHON_LIBS-instead-of-PYTHON_LDFLAGS.patch # Only needed for builds from svn snapshot @@ -357,6 +359,9 @@ rm -rf doc/man %doc doc %changelog +* Fri Feb 25 2022 Richard Lescak - 1.7.1-10 +- use Python LIBS instead of LDFLAGS - fix annocheck issues + * Thu Feb 24 2022 Richard Lescak - 1.7.1-9 - Fix for CVE-2020-19860 ldns: heap overread vulnerability (#2051211) - Added also patch for deprecated distutils Python module used in build