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

josharian opened this issue Oct 23, 2013 · 5 comments


Copy link

@josharian josharian 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. 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?)
Copy link

@davecheney davecheney 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.

Copy link

@rsc rsc 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.
Copy link

@bradfitz bradfitz commented Oct 25, 2013

Comment 3:

Josh sent a fix:

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

Owner changed to @rsc.

Status changed to Started.

Copy link

@rsc rsc commented Oct 28, 2013

Comment 4:

This issue was closed by revision 5644774.

Status changed to Fixed.

Copy link

@adg adg 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
…s correctly in readLine

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

Fixes #6646.

R=rsc, bradfitz


@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.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants