Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2753)

Issue 181097: code review 181097: Allow Hostname to return FQDN when /bin/hostname does not

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 4 months ago by icarus
Modified:
2 years ago
Reviewers:
rsc1
CC:
rsc, golang-dev
Visibility:
Public.

Description

Allow Hostname to return FQDN when /bin/hostname does not Hostname reads the file /proc/sys/kernel/hostname to determine the value it returns. Some people set this to a Fully Qualified Doamin Name. At least one implementation of /bin/hostname truncates the name it gets (often from the "uname" system call) at the first dot unless it is given a "-f" flag. This change makes the unit test also truncate at the first dot and checks if the strings then match. This seems more portable than adding an extra flag to the called /bin/hostname program.

Patch Set 1 #

Patch Set 2 : code review 181097: Allow Hostname to return FQDN when /bin/hostname does not #

Total comments: 1

Patch Set 3 : code review 181097: Allow Hostname to return FQDN when /bin/hostname does not #

Unified diffs Side-by-side diffs Delta from patch set Stats (+6 lines, -1 line) Patch
M src/pkg/os/os_test.go View 1 2 1 chunk +6 lines, -1 line 0 comments Download

Messages

Total messages: 11
icarus
Hello golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com), I'd like you to review the following change.
14 years, 4 months ago (2009-12-29 21:31:05 UTC) #1
iant
What system do you notice this problem on? http://codereview.appspot.com/181097/diff/1001/4 File src/pkg/os/os_test.go (right): http://codereview.appspot.com/181097/diff/1001/4#newcode647 src/pkg/os/os_test.go:647: func ...
14 years, 4 months ago (2009-12-31 00:14:59 UTC) #2
icarus
On 2009/12/31 00:14:59, iant wrote: > What system do you notice this problem on? Debian ...
14 years, 4 months ago (2009-12-31 01:37:43 UTC) #3
cw
I think perhaps we should introduce os.Uname and plumb that in. For linux it's a ...
14 years, 4 months ago (2009-12-31 03:35:43 UTC) #4
dho
2009/12/30 <cw@f00f.org>: > I think perhaps we should introduce os.Uname and plumb that in. > ...
14 years, 4 months ago (2009-12-31 03:43:00 UTC) #5
rsc
14 years, 3 months ago (2010-01-05 22:48:44 UTC) #6
rsc
On 2009/12/31 03:35:43, cw wrote: > I think perhaps we should introduce os.Uname and plumb ...
14 years, 3 months ago (2010-01-08 08:24:05 UTC) #7
rsc
On 2009/12/29 21:31:05, icarus wrote: > Hello mailto:golang-dev@googlegroups.com (cc: mailto:golang-dev@googlegroups.com), > > I'd like you ...
14 years, 3 months ago (2010-01-08 08:27:47 UTC) #8
icarus
On 2010/01/08 08:27:47, rsc wrote: > On 2009/12/29 21:31:05, icarus wrote: > > Hello mailto:golang-dev@googlegroups.com ...
14 years, 3 months ago (2010-01-11 23:34:12 UTC) #9
rsc1
LGTM catching up on code reviews, sorry for the delay.
14 years, 3 months ago (2010-01-26 20:36:52 UTC) #10
rsc
14 years, 3 months ago (2010-01-26 21:16:05 UTC) #11
*** Submitted as http://code.google.com/p/go/source/detail?r=cb37c45d40ae ***

os: in test, allow Hostname to return FQDN even if /bin/hostname does not

Hostname reads the file /proc/sys/kernel/hostname to determine
the value it returns. Some people set this to a Fully Qualified
Doamin Name. At least one implementation of /bin/hostname
truncates the name it gets (often from the "uname" system call)
at the first dot unless it is given a "-f" flag. This change makes
the unit test also truncate at the first dot and checks if the strings
then match. This seems more portable than adding an extra flag
to the called /bin/hostname program.

R=rsc
CC=golang-dev
http://codereview.appspot.com/181097

Committer: Russ Cox <rsc@golang.org>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b