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

Comments

Projects
None yet
3 participants
@gopherbot
Copy link

commented Sep 11, 2013

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

This comment has been minimized.

Copy link
Author

commented Sep 11, 2013

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

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Author

commented Sep 17, 2013

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

This comment has been minimized.

Copy link
Contributor

commented Nov 27, 2013

Comment 4:

Labels changed: added go1.3maybe.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Dec 4, 2013

Comment 5:

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

@rsc

This comment has been minimized.

Copy link
Contributor

commented Dec 4, 2013

Comment 6:

Labels changed: added repo-main.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015

@mikioh

This comment has been minimized.

Copy link
Contributor

commented Jun 19, 2015

Closing. TestLookupHost was removed by 047f07a.

@mikioh mikioh closed this 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.
You can’t perform that action at this time.