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
Comments
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. |
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. |
libc treats /etc/hosts as case-insensitive, so so should we. |
CL https://golang.org/cl/15321 mentions this issue. |
CL https://golang.org/cl/17217 mentions this issue. |
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>
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
The text was updated successfully, but these errors were encountered: