From 348d01cc21e58db482d2970ead425ed06c7eb7c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Fri, 26 Mar 2021 11:21:37 +0100 Subject: [PATCH] Allow use of isc/util.h without "config.h" It prevents compilation of bind-dyndb-ldap. Because config.h is never used by bind-dyndb-ldap, stop exporting it in devel package. It should be only implementation detail. (cherry picked from commit 2e4a03677c85aae0659ec29432362548ce722747) Resolves: rhbz#1956777 --- bind-9.16-isc-constructor.h | 53 +++++++++++++++++++++++++++++++++++++ bind.spec | 9 +++---- 2 files changed, 56 insertions(+), 6 deletions(-) create mode 100644 bind-9.16-isc-constructor.h diff --git a/bind-9.16-isc-constructor.h b/bind-9.16-isc-constructor.h new file mode 100644 index 0000000..71a08b3 --- /dev/null +++ b/bind-9.16-isc-constructor.h @@ -0,0 +1,53 @@ +From 48df32cadb5071f5b186b00da3f4406a13320b44 Mon Sep 17 00:00:00 2001 +From: Petr Mensik +Date: Fri, 26 Mar 2021 11:01:59 +0100 +Subject: [PATCH] Do not require config.h to use isc/util.h + +util.h requires ISC_CONSTRUCTOR definition, which depends on config.h +inclusion. It does not include it from isc/util.h (or any other header). +Using isc/util.h fails hard when isc/util.h is used without including +bind's config.h. + +Move the check to c file, where ISC_CONSTRUCTOR is used. Ensure config.h +is included there. +--- + lib/isc/include/isc/util.h | 2 -- + lib/isc/lib.c | 5 +++++ + 2 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/lib/isc/include/isc/util.h b/lib/isc/include/isc/util.h +index 3c8c40b..3144557 100644 +--- a/lib/isc/include/isc/util.h ++++ b/lib/isc/include/isc/util.h +@@ -54,8 +54,6 @@ + #elif WIN32 + #define ISC_CONSTRUCTOR(priority) + #define ISC_DESTRUCTOR(priority) +-#else +-#error Either __attribute__((constructor|destructor))__ or DllMain support needed to compile BIND 9. + #endif + + /*% +diff --git a/lib/isc/lib.c b/lib/isc/lib.c +index 27d7be1..08a1b91 100644 +--- a/lib/isc/lib.c ++++ b/lib/isc/lib.c +@@ -17,10 +17,15 @@ + #include + #include + ++#include "config.h" + #include "mem_p.h" + #include "tls_p.h" + #include "trampoline_p.h" + ++#ifndef ISC_CONSTRUCTOR ++#error Either __attribute__((constructor|destructor))__ or DllMain support needed to compile BIND 9. ++#endif ++ + /*** + *** Functions + ***/ +-- +2.26.2 + diff --git a/bind.spec b/bind.spec index b17e8dc..c8d95c0 100644 --- a/bind.spec +++ b/bind.spec @@ -114,6 +114,8 @@ Patch157:bind-9.11-fips-tests.patch Patch164:bind-9.11-rh1666814.patch Patch170:bind-9.11-feature-test-named.patch Patch171:bind-9.11-tests-variants.patch +# https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/4840 +Patch172:bind-9.16-isc-constructor.h Requires(post): systemd Requires(preun): systemd @@ -418,6 +420,7 @@ in HTML and PDF format. %patch164 -p1 -b .rh1666814 %patch170 -p1 -b .featuretest-named %patch171 -p1 -b .test-variant +%patch172 -p1 -b .isc-constructor %if %{with PKCS11} %patch135 -p1 -b .config-pkcs11 @@ -708,11 +711,6 @@ install -m 644 %{SOURCE49} ${RPM_BUILD_ROOT}%{_sysconfdir}/named-chroot.files # Install isc/errno2result.h header install -m 644 lib/isc/unix/errno2result.h ${RPM_BUILD_ROOT}%{_includedir}/bind9/isc -pushd build -# Files required to run test-suite outside of build tree: -cp -fp config.h ${RPM_BUILD_ROOT}/%{_includedir}/bind9 -popd - # Remove libtool .la files: find ${RPM_BUILD_ROOT}/%{_libdir} -name '*.la' -exec '/bin/rm' '-f' '{}' ';'; @@ -1035,7 +1033,6 @@ fi; %{_libdir}/libisc.so %{_libdir}/libisccfg.so %dir %{_includedir}/bind9 -%{_includedir}/bind9/config.h %{_includedir}/bind9/bind9 %{_includedir}/bind9/isccc %{_includedir}/bind9/ns