Thomas Goirand wrote: > On 9/10/21 10:53 AM, Josh Triplett wrote: > > Thomas Goirand wrote: > >> On 9/8/21 6:01 PM, Josh Triplett wrote: > >>> Now, that said, if the build process actually wants a DNS server to > >>> run tests against, it should provide or depend on such a DNS server, > >>> and configure it for such tests. > >> > >> Just to be 100% sure we're on the same page: that's *not* what dnspython > >> is doing. It's a client library that's testing parsing of the > >> /etc/resolv.conf format, and it just expects it to be there for parsing. > > > > I understood that; I'd just wanted to make it clear that while programs > > parsing /etc/resolv.conf should assume a nameserver on localhost if > > /etc/resolv.conf doesn't exist > > I don't understand why that should be the case. If there's a local > nameserver, then it should be configured in resolv.conf as "nameserver > 127.0.0.1" no?
Three reasons: - It's the documented behavior when /etc/resolv.conf doesn't exist. `man resolv.conf` says "If this file does not exist, only the name server on the local machine will be queried, and the search list contains the local domain name determined from the hostname.". - It's the established historical behavior of glibc, musl, adns, and various other resolvers, so breaking it would also be a backwards compatibility break. - This behavior allows providing DNS for a chroot or similar without hacks like mounting a file over /etc/resolv.conf.