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: DNS fails to resolve when /etc/resolv.conf contains a single, non-\n-terminated line #6646

Closed
josharian opened this issue Oct 23, 2013 · 5 comments

Comments

Projects
None yet
6 participants
@josharian
Copy link
Contributor

commented Oct 23, 2013

1. Edit your /etc/resolv.conf to contain a single, non-\n-terminated line.
2. Try to resolve a DNS entry.

Result: No entries are read from /etc/resolv.conf, and DNS lookups fail.


Which version are you using?  (run 'go version')

Reproduces on tip as of:

go version devel +f257b02e7ffe Wed Oct 23 10:28:28 2013 -0400 darwin/amd64


Please provide any additional information below.

Discovered thanks to DNS failures in the wild; took a while to track down. The problem
is that readLine reads no data from single-line non-\n-terminated files.

https://golang.org/cl/15960047 fixes the problem. Writing tests for this part
of the stdlib would require some refactoring.

(Looks like this part of the stdlib is fairly old. E.g. it uses make(T, size)[0:0],
which I presume was an idiom before make accepted a capacity. It could probably do with
some modernization, refactoring, and tests, but that's out of scope here. It is worth
filing a separate issue?)
@davecheney

This comment has been minimized.

Copy link
Contributor

commented Oct 23, 2013

Comment 1:

I don't think this is a blocker for 1.2 and I would like to see it tackled as part of a
cleanup of the parse code in 1.3.

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

Status changed to Accepted.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Oct 23, 2013

Comment 2:

please mail the CL. i'll take it for Go 1.2.
i ran into this in a different context (/etc/hosts) too.
@bradfitz

This comment has been minimized.

Copy link
Member

commented Oct 25, 2013

Comment 3:

Josh sent a fix: https://golang.org/cl/15960047/

Labels changed: added go1.2, removed priority-later, go1.3.

Owner changed to @rsc.

Status changed to Started.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Oct 28, 2013

Comment 4:

This issue was closed by revision 5644774.

Status changed to Fixed.

@adg

This comment has been minimized.

Copy link
Contributor

commented Nov 1, 2013

Comment 5:

This issue was closed by revision 61208fcb2dfc.

@josharian josharian added fixed labels Nov 1, 2013

@rsc rsc added this to the Go1.2 milestone Apr 14, 2015

@rsc rsc removed the go1.2 label Apr 14, 2015

adg added a commit that referenced this issue May 11, 2015

[release-branch.go1.2] net: handle single-line non-\n-terminated file…
…s correctly in readLine

««« CL 15960047 / a0d4544cdb2a
net: handle single-line non-\n-terminated files correctly in readLine

Fixes #6646.

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/15960047

»»»

R=golang-dev
CC=golang-dev
https://golang.org/cl/20560044

@golang golang locked and limited conversation to collaborators Jun 25, 2016

This issue was closed.

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.