From 3be119d5ba4321fc5a8bde5ac8ae9124f5c54ea2 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sat, 1 Feb 2020 14:53:46 +0100 Subject: [PATCH] libmilter: fix build w/glibc-2.30 Using RES_USE_INET6 is deprecated and has been removed by glibc 2.30[1]. Instead, there's now a function `gethostbyname2(3)` which takes the address family as second argument to force IPv6 resolution[2]. [1] https://sourceware.org/ml/libc-alpha/2019-08/msg00029.html [2] https://linux.die.net/man/3/gethostbyname2 --- .../libraries/libmilter/default.nix | 2 +- .../libraries/libmilter/glibc-2.30.patch | 44 +++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/libraries/libmilter/glibc-2.30.patch diff --git a/pkgs/development/libraries/libmilter/default.nix b/pkgs/development/libraries/libmilter/default.nix index 3eb688f95721..8d677d858de8 100644 --- a/pkgs/development/libraries/libmilter/default.nix +++ b/pkgs/development/libraries/libmilter/default.nix @@ -31,7 +31,7 @@ stdenv.mkDerivation rec { sh Build -f ./a.m4 ''; - patches = [ ./install.patch ./sharedlib.patch ]; + patches = [ ./install.patch ./sharedlib.patch ./glibc-2.30.patch ]; nativeBuildInputs = [ m4 ]; diff --git a/pkgs/development/libraries/libmilter/glibc-2.30.patch b/pkgs/development/libraries/libmilter/glibc-2.30.patch new file mode 100644 index 000000000000..e72ec9911e37 --- /dev/null +++ b/pkgs/development/libraries/libmilter/glibc-2.30.patch @@ -0,0 +1,44 @@ +diff --git a/libmilter/sm_gethost.c b/libmilter/sm_gethost.c +index 2423c34..f00468c 100644 +--- a/libmilter/sm_gethost.c ++++ b/libmilter/sm_gethost.c +@@ -52,16 +52,8 @@ sm_getipnodebyname(name, family, flags, err) + bool resv6 = true; + struct hostent *h; + +- if (family == AF_INET6) +- { +- /* From RFC2133, section 6.1 */ +- resv6 = bitset(RES_USE_INET6, _res.options); +- _res.options |= RES_USE_INET6; +- } + SM_SET_H_ERRNO(0); +- h = gethostbyname(name); +- if (family == AF_INET6 && !resv6) +- _res.options &= ~RES_USE_INET6; ++ h = gethostbyname2(name, family); + + /* the function is supposed to return only the requested family */ + if (h != NULL && h->h_addrtype != family) +diff --git a/sendmail/conf.c b/sendmail/conf.c +index c73334e..500dafb 100644 +--- a/sendmail/conf.c ++++ b/sendmail/conf.c +@@ -4243,16 +4243,8 @@ sm_getipnodebyname(name, family, flags, err) + # else /* HAS_GETHOSTBYNAME2 */ + bool resv6 = true; + +- if (family == AF_INET6) +- { +- /* From RFC2133, section 6.1 */ +- resv6 = bitset(RES_USE_INET6, _res.options); +- _res.options |= RES_USE_INET6; +- } + SM_SET_H_ERRNO(0); +- h = gethostbyname(name); +- if (!resv6) +- _res.options &= ~RES_USE_INET6; ++ h = gethostbyname2(name, family); + + /* the function is supposed to return only the requested family */ + if (h != NULL && h->h_addrtype != family)