From 7d96471775afbb23222aebae6343f410421ab428 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 8 Apr 2008 12:28:03 +0000 Subject: [PATCH] * Ignore services in nsswitch.conf that cannot be found (like "mdns4_mininal" on Ubuntu). This is a fix for NIXPKGS-79. It doesn't *quite* fix the problem in all cases (there might be people actually using mDNS; they should just run the "nscd" daemon) but at least it should keep curl from failing in Nixpkgs downloads. svn path=/nixpkgs/branches/stdenv-updates/; revision=11487 --- .../libraries/glibc-2.7/default.nix | 25 +++++++++++++++++++ .../glibc-2.7/nss-skip-unavail.patch | 25 +++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 pkgs/development/libraries/glibc-2.7/nss-skip-unavail.patch diff --git a/pkgs/development/libraries/glibc-2.7/default.nix b/pkgs/development/libraries/glibc-2.7/default.nix index f33f95fda9fe..7eb34e88899a 100644 --- a/pkgs/development/libraries/glibc-2.7/default.nix +++ b/pkgs/development/libraries/glibc-2.7/default.nix @@ -16,6 +16,31 @@ stdenv.mkDerivation { inherit (stdenv) is64bit; + patches = [ + /* Fix for NIXPKGS-79: when doing host name lookups, when + nsswitch.conf contains a line like + + hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 + + don't return an error when mdns4_minimal can't be found. This + is a bug in Glibc: when a service can't be found, NSS should + continue to the next service unless "UNAVAIL=return" is set. + ("NOTFOUND=return" refers to the service returning a NOTFOUND + error, not the service itself not being found.) The reason is + that the "status" variable (while initialised to UNAVAIL) is + outside of the loop that iterates over the services, the + "files" service sets status to NOTFOUND. So when the call to + find "mdns4_minimal" fails, "status" will still be NOTFOUND, + and it will return instead of continuing to "dns". Thus, the + line + + hosts: mdns4_minimal [NOTFOUND=return] dns mdns4 + + does work because "status" will contain UNAVAIL after the + failure to find mdns4_minimal. */ + ./nss-skip-unavail.patch + ]; + # `--with-tls --without-__thread' enables support for TLS but causes # it not to be used. Required if we don't want to barf on 2.4 # kernels. Or something. diff --git a/pkgs/development/libraries/glibc-2.7/nss-skip-unavail.patch b/pkgs/development/libraries/glibc-2.7/nss-skip-unavail.patch new file mode 100644 index 000000000000..4d29082f9419 --- /dev/null +++ b/pkgs/development/libraries/glibc-2.7/nss-skip-unavail.patch @@ -0,0 +1,25 @@ +diff -rc glibc-2.7-orig/sysdeps/posix/getaddrinfo.c glibc-2.7/sysdeps/posix/getaddrinfo.c +*** glibc-2.7-orig/sysdeps/posix/getaddrinfo.c 2007-10-17 18:05:12.000000000 +0200 +--- glibc-2.7/sysdeps/posix/getaddrinfo.c 2008-04-08 12:17:09.000000000 +0200 +*************** +*** 498,505 **** + int no_data = 0; + int no_inet6_data = 0; + service_user *nip = NULL; +- enum nss_status inet6_status = NSS_STATUS_UNAVAIL; +- enum nss_status status = NSS_STATUS_UNAVAIL; + int no_more; + int old_res_options; + +--- 498,503 ---- +*************** +*** 689,694 **** +--- 687,694 ---- + + while (!no_more) + { ++ enum nss_status inet6_status = NSS_STATUS_UNAVAIL; ++ enum nss_status status = NSS_STATUS_UNAVAIL; + nss_gethostbyname3_r fct = NULL; + if (req->ai_flags & AI_CANONNAME) + /* No need to use this function if we do not look for