Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net: tests fail if /etc/hosts lists localhost 127.0.0.1 twice #6363

Closed
gopherbot opened this issue Sep 11, 2013 · 7 comments
Closed

net: tests fail if /etc/hosts lists localhost 127.0.0.1 twice #6363

gopherbot opened this issue Sep 11, 2013 · 7 comments
Milestone

Comments

@gopherbot
Copy link

by jaq@spacepants.org:

I just downloaded the source code release branch from code.google.com per the
instructions, then ran all.bash:

hg clone ...
hg update release
cd go/src
./all.bash
...
--- FAIL: TestLookupHost (0.00 seconds)
    hosts_test.go:65: LookupHost("localhost") = [127.0.0.1 127.0.0.1], has duplicate addresses
FAIL
FAIL    net 2.379s
...

My /etc/hosts is managed by a config management tool and just happens to have put two
localhost entries in there (I didn't know this until now ;-)

cat /etc/hosts
...
127.0.0.1   gunstar localhost
...
127.0.0.1   localhost   

The test seems a bit fragile because it relies on config outside the control of the Go
source code.
@gopherbot
Copy link
Author

Comment 1 by jaq@spacepants.org:

I am not smart enough to understand the comment in that test:
"make sure it doesn't
    // duplicate addresses (a common bug due to the way
    // getaddrinfo works)."
getaddrinfo seems to be working as intended.

@rsc
Copy link
Contributor

rsc commented Sep 11, 2013

Comment 2:

Everything about the net tests is a little fragile. Even so, they serve a useful purpose.
What this test is referring to is that getaddrinfo will return 127.0.0.1 once for
SOCK_STREAM and once for SOCK_DGRAM, even when it appears just once in the hosts file.
In this case it has returned it four times, and the Go code has (correctly I think) cut
it down to two.
I'm inclined to leave this as is unless more people run into it.
Is it possible for you to get your /etc/hosts fixed?

Labels changed: added priority-later, removed priority-triage.

Status changed to Thinking.

@gopherbot
Copy link
Author

Comment 3 by jaq@spacepants.org:

I thought that would be the response :)
I managed to get golang installed by removing the duplicate entry, but the configuration
management is out of my control.

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 4:

Labels changed: added go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 5:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 6:

Labels changed: added repo-main.

@mikioh
Copy link
Contributor

mikioh commented Jun 19, 2015

Closing. TestLookupHost was removed by 047f07a.

@mikioh mikioh closed this as completed Jun 19, 2015
@mikioh mikioh removed the Thinking label Jun 19, 2015
@mikioh mikioh modified the milestones: Go1.5, Unplanned Jun 19, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants