[Bug 408901] Re: when /etc/hosts doesn't exist, apt fails to resolve hostnames using libc6

Bug Watch Updater 408901 at bugs.launchpad.net
Thu May 26 11:35:41 UTC 2011


Launchpad has imported 5 comments from the remote bug at
http://sourceware.org/bugzilla/show_bug.cgi?id=10540.

If you reply to an imported comment from within Launchpad, your comment
will be sent to the remote bug automatically. Read more about
Launchpad's inter-bugtracker facilities at
https://help.launchpad.net/InterBugTracking.

------------------------------------------------------------------------
On 2009-08-20T12:30:35+00:00 Steve Langasek wrote:

glibc 2.10 introduces a regression in getaddrinfo(); with a standard
nsswitch.conf:

$ grep host /etc/nsswitch.conf 
hosts:          files dns
$

and no /etc/hosts file on the system (which is legitimate; e.g., in a
chroot):

$ cat /etc/hosts
cat: /etc/hosts: No such file or directory
$

all calls to getaddrinfo() will fail, short-circuited by an nss_files failure
before invoking nss_dns.

Trivial test case, patch to follow.

Reply at: https://bugs.launchpad.net/glibc/+bug/408901/comments/9

------------------------------------------------------------------------
On 2009-08-20T12:32:19+00:00 Steve Langasek wrote:

Created attachment 4142
test case

Reply at: https://bugs.launchpad.net/glibc/+bug/408901/comments/10

------------------------------------------------------------------------
On 2009-08-20T12:34:32+00:00 Steve Langasek wrote:

Created attachment 4143
patch to nss_files fixing getaddrinfo when /etc/hosts is absent

Reply at: https://bugs.launchpad.net/glibc/+bug/408901/comments/11

------------------------------------------------------------------------
On 2009-10-30T05:05:33+00:00 Drepper-fsp wrote:

I applied the patch.

Reply at: https://bugs.launchpad.net/glibc/+bug/408901/comments/12

------------------------------------------------------------------------
On 2009-12-19T13:28:52+00:00 Hermier wrote:

Seems the fix is incorrect, on 2.11 I get:

bash-4.0# gcc bug-408901.c
bash-4.0# ./a.out www.redhat.com
www.redhat.com -5
bash-4.0# touch /etc/hosts
bash-4.0# ./a.out www.redhat.com
www.redhat.com 0

It seems that returning NO_DATA (in the patch) stops the host search
prematurely. Instead returning HOST_NOT_FOUND fix the issue, and sounds more
logical.

Reply at: https://bugs.launchpad.net/glibc/+bug/408901/comments/13


** Changed in: glibc
   Importance: Unknown => Medium

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to eglibc in Ubuntu.
https://bugs.launchpad.net/bugs/408901

Title:
  when /etc/hosts doesn't exist, apt fails to resolve hostnames using
  libc6

Status in The GNU C Library:
  Confirmed
Status in “eglibc” package in Ubuntu:
  Fix Released
Status in “eglibc” source package in Karmic:
  Fix Released
Status in “eglibc” package in Debian:
  Unknown

Bug description:
  the lack of /etc/hosts should not prevent a host with /etc/resolv.conf
  from resolving hostnames.

  Interestingly, ping and a few other applications resolve hosts just
  fine with no /etc/hosts on the system, apt does not.

  lamont




More information about the foundations-bugs mailing list