[Pkg-rust-maintainers] Bug#842634: Bug#842634: rustc: FTBFS (sys_common::net::tests::no_lookup_host_duplicates fails)

Ralph Giles giles at thaumas.net
Tue Nov 29 18:07:51 UTC 2016


On 2016-11-29 1:17 AM, Santiago Vila wrote:

> I wonder, however, why two lines like this in /etc/hosts
> 
> 127.0.0.1       localhost
> 127.0.0.1       localhost ip6-localhost ip6-loopback
> 
> should make rustc build to fail at all.

The test was added in https://github.com/rust-lang/rust/pull/34700 to
guard against regression of a bug where std::net::lookup_host()
incorrectly returned multiple copies of each address.

The /etc/hosts database format certainly allows duplicate entries. It
seems that glibc, at least, does not merge those, but instead returns
the listed n-to-m mappings directly through the `struct hostent`
returned by both gethostbyaddr() and gethostbyname().

Even if it doesn't violate any spec, I agree with Luca that this is a
misconfiguration. The normal application of multiple address entries
is for service failover. Any client connecting to localhost with your
configuration will immediately retry connection failures, which is a
waste of resources.

More practically, I don't see a way to make the test work in your
environment without implementing a separate /etc/hosts parser. I think
that would be a lot of code to justify in this case.

 -r



More information about the Pkg-rust-maintainers mailing list