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: hosts.go lookupStaticHost is case-sensitive #12806

Closed
corymintz opened this issue Oct 1, 2015 · 6 comments
Closed

net: hosts.go lookupStaticHost is case-sensitive #12806

corymintz opened this issue Oct 1, 2015 · 6 comments
Assignees
Milestone

Comments

@corymintz
Copy link

@corymintz corymintz commented Oct 1, 2015

Go 1.5.1, Linux amd64.

Given: net.LookupHost("Blah")
The resolution will fail if the /etc/hosts file contains:
127.0.0.1 blah
and succeeds if it contains:
127.0.0.1 Blah

Hostnames are expected to be case-insensitive

@rakyll

This comment has been minimized.

Copy link
Member

@rakyll rakyll commented Oct 1, 2015

Name resolution via a hosts file was considered case sensitive in UNIX-like operating systems even though the standardization attempts of the hosts files (rfc952) suggests it must be case insensitive. I am not quite sure what the correct behavior we must bless but the host names in /etc/hosts are conventionally considered case sensitive.

@corymintz

This comment has been minimized.

Copy link
Author

@corymintz corymintz commented Oct 1, 2015

Are there any current examples on Linux where it would be case-sensitive? This was hit because of an upgrade from Go 1.4 to 1.5 (because of the default change from cgo to the go resolver on Linux). If there is indeed conflicting info I think maintaining compatibly on upgrade to 1.5 should be the tie breaker.

@rakyll

This comment has been minimized.

Copy link
Member

@rakyll rakyll commented Oct 1, 2015

@rakyll rakyll added this to the Go1.6 milestone Oct 1, 2015
@bradfitz

This comment has been minimized.

Copy link
Contributor

@bradfitz bradfitz commented Oct 1, 2015

libc treats /etc/hosts as case-insensitive, so so should we.

@rakyll rakyll self-assigned this Oct 1, 2015
@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Oct 1, 2015

CL https://golang.org/cl/15321 mentions this issue.

@rakyll rakyll closed this in d96a3a2 Oct 1, 2015
@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Nov 27, 2015

CL https://golang.org/cl/17217 mentions this issue.

mikioh pushed a commit that referenced this issue Nov 27, 2015
The previous change for #12806 modified internal lookup tables and made
LookupAddr return forcibly lowercased host names by accident.

This change fixes the issue again without any behavioral change for
LookupAddr and adds missing test cases for lookupStaticHost and
lookupStaticAddr.

Updates #12806.
Fixes #13359.

Change-Id: Ifff4741cd79eb8b320b1b0f8c5e02b3a167c9fa8
Reviewed-on: https://go-review.googlesource.com/17217
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
@golang golang locked and limited conversation to collaborators Nov 27, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.