From dd79d39eee844324ccbce095e20c279a0834954e Mon Sep 17 00:00:00 2001 From: Petr Menšík Date: Jan 09 2018 17:19:55 +0000 Subject: Fix machine portability issues, fixes unit tests on non-x86 architectures --- diff --git a/bind-9.11-kyua-portfix.patch b/bind-9.11-kyua-portfix.patch new file mode 100644 index 0000000..09e57a5 --- /dev/null +++ b/bind-9.11-kyua-portfix.patch @@ -0,0 +1,60 @@ +From 822739a9f5163f6836a05e694faaa7b88d74f39c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= +Date: Tue, 9 Jan 2018 17:01:04 +0100 +Subject: [PATCH] Fix machine portability issues, fixes tests on non-x86 + architectures + +--- + lib/isc/tests/hash_test.c | 15 +++++++++++++++ + lib/isc/unix/include/isc/int.h | 2 +- + 2 files changed, 16 insertions(+), 1 deletion(-) + +diff --git a/lib/isc/tests/hash_test.c b/lib/isc/tests/hash_test.c +index 0c287e83fa..d51b44fa26 100644 +--- a/lib/isc/tests/hash_test.c ++++ b/lib/isc/tests/hash_test.c +@@ -1784,6 +1784,18 @@ ATF_TC_BODY(isc_hmacmd5, tc) { + } + #endif + ++#ifdef WORDS_BIGENDIAN ++/* Source: https://stackoverflow.com/questions/2182002/convert-big-endian-to-little-endian-in-c-without-using-provided-func */ ++static inline isc_uint64_t ++swap_uint64(isc_uint64_t val) { ++ val = ((val << 8) & 0xFF00FF00FF00FF00ULL ) | ++ ((val >> 8) & 0x00FF00FF00FF00FFULL ); ++ val = ((val << 16) & 0xFFFF0000FFFF0000ULL ) | ++ ((val >> 16) & 0x0000FFFF0000FFFFULL ); ++ return (val << 32) | (val >> 32); ++} ++#endif ++ + /* CRC64 Test */ + ATF_TC(isc_crc64); + ATF_TC_HEAD(isc_crc64, tc) { +@@ -1839,6 +1851,9 @@ ATF_TC_BODY(isc_crc64, tc) { + testcase->input_len); + } + isc_crc64_final(&crc); ++#ifdef WORDS_BIGENDIAN ++ crc = swap_uint64(crc); ++#endif + tohexstr((unsigned char *) &crc, sizeof(crc), str); + ATF_CHECK_STREQ(str, testcase->result); + +diff --git a/lib/isc/unix/include/isc/int.h b/lib/isc/unix/include/isc/int.h +index 00fc048f65..706353eaca 100644 +--- a/lib/isc/unix/include/isc/int.h ++++ b/lib/isc/unix/include/isc/int.h +@@ -13,7 +13,7 @@ + + /*! \file */ + +-typedef char isc_int8_t; ++typedef signed char isc_int8_t; + typedef unsigned char isc_uint8_t; + typedef short isc_int16_t; + typedef unsigned short isc_uint16_t; +-- +2.14.3 + diff --git a/bind.spec b/bind.spec index b7a88cd..d89c772 100644 --- a/bind.spec +++ b/bind.spec @@ -94,6 +94,7 @@ Patch147:bind-9.11-kyua.patch # [ISC-Bugs #46853] commit cb616c6d5c2ece1fac37fa6e0bca2b53d4043098 ISC 4851 Patch148:bind-9.11-kyua-unit.patch Patch149:bind-9.11-kyua-pkcs11.patch +Patch150:bind-9.11-kyua-portfix.patch # SDB patches Patch11: bind-9.3.2b2-sdbsrc.patch @@ -401,6 +402,7 @@ This package provides a module which allows commands to be sent to rndc directly %patch146 -p1 -b .rh1500017 %patch147 -p1 -b .kyua %patch148 -p1 -b .kyua-unit +%patch150 -p1 -b .kyua-portfix %if %{PKCS11} cp -r bin/named{,-pkcs11}