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
Milestone

Comments

@corymintz
Copy link

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
Copy link
Contributor

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
Copy link
Author

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
Copy link
Contributor

rakyll commented Oct 1, 2015

/cc @rsc @bradfitz

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

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
Copy link

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

@rakyll rakyll closed this as completed in d96a3a2 Oct 1, 2015
@gopherbot
Copy link

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
@rsc rsc unassigned rakyll Jun 23, 2022
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

4 participants