Bug#343140: libc6: resolver always checks search list in /etc/resolv.conf
Gabor Gombas wrote:
Ok, let's clarify some things here. resolv.conf(5) describes the
behaviour of a _single_ resolver query. If you look at
resolv/nss_dns/dns-host.c in the glibc source, you'll see that
gethostbyname(3) is implemented as _two_ distinct resolver invocations.
Since it is nowhere specified how many resolver invocations
gethostbyname(3) should cause, the glibc behaviour is correct and will
result in the second list of DNS queries you specified.
That would explain the behavior yes. Constraints in gethostbyname
notwithstanding, it still feels like an OS bug. Perhaps not a glibc bug
If you want to avoid the extra query, you should use getaddrinfo(3) or
the GNU-specific gethostbyname2(3) and specify explicitely the address
family you are interested in.
I think postfix was moving away from gethostbyname in favor of
getaddrinfo. So maybe some of the postfix-related problems will go away
in the future. At the moment though, the sarge combo of postfix +
glibc's IPv6 support + search/domain lines results in very unexpected,
undesirable behavior, especially when compared to woody which by default
did not do these extra lookups.
Thanks for your help.