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

Issue 69910043: code review 69910043: syscall: make address of unnamed Unix sockets empty on ...

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 1 month ago by remyoudompheng
Modified:
10 years ago
CC:
mikio
Visibility:
Public.

Description

syscall: make address of unnamed Unix sockets empty on Linux. Fixes issue 7354.

Patch Set 1 #

Patch Set 2 : diff -r f62cd90ce0d8 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r f62cd90ce0d8 https://go.googlecode.com/hg/ #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+27 lines, -28 lines) Patch
M src/pkg/net/unix_test.go View 1 2 chunks +0 lines, -6 lines 0 comments Download
M src/pkg/syscall/route_bsd.go View 1 4 chunks +4 lines, -4 lines 0 comments Download
M src/pkg/syscall/route_darwin.go View 1 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/syscall/route_dragonfly.go View 1 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/syscall/route_freebsd.go View 1 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/syscall/syscall_bsd.go View 1 4 chunks +4 lines, -4 lines 0 comments Download
M src/pkg/syscall/syscall_linux.go View 1 6 chunks +10 lines, -5 lines 2 comments Download
M src/pkg/syscall/syscall_solaris.go View 1 4 chunks +4 lines, -4 lines 0 comments Download
M src/pkg/syscall/syscall_unix.go View 1 2 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 9
remyoudompheng
Hello golang-codereviews@googlegroups.com, I'd like you to review this change to https://go.googlecode.com/hg/
10 years, 1 month ago (2014-02-28 07:12:09 UTC) #1
bradfitz
LGTM but wait a bit to see if others have feedback
10 years, 1 month ago (2014-02-28 15:47:04 UTC) #2
rsc
Why is the len being introduced?
10 years, 1 month ago (2014-03-04 00:05:17 UTC) #3
remyoudompheng
2014-03-04 1:05 GMT+01:00 <rsc@golang.org>: > Why is the len being introduced? An unnamed socket and ...
10 years, 1 month ago (2014-03-04 00:15:30 UTC) #4
rsc
I think you can drop the new len parameter. We know the length. If nothing ...
10 years, 1 month ago (2014-03-04 00:48:07 UTC) #5
remyoudompheng
https://codereview.appspot.com/69910043/diff/40001/src/pkg/syscall/syscall_linux.go File src/pkg/syscall/syscall_linux.go (right): https://codereview.appspot.com/69910043/diff/40001/src/pkg/syscall/syscall_linux.go#newcode355 src/pkg/syscall/syscall_linux.go:355: if uintptr(rsalen) == unsafe.Sizeof(rsa.Addr.Family) { On 2014/03/04 00:48:07, rsc ...
10 years, 1 month ago (2014-03-07 06:10:07 UTC) #6
mikio
On Fri, Mar 7, 2014 at 3:10 PM, <remyoudompheng@gmail.com> wrote: > You could have an ...
10 years, 1 month ago (2014-03-07 07:59:03 UTC) #7
rsc
On 2014/03/07 06:10:07, remyoudompheng wrote: > https://codereview.appspot.com/69910043/diff/40001/src/pkg/syscall/syscall_linux.go > File src/pkg/syscall/syscall_linux.go (right): > > https://codereview.appspot.com/69910043/diff/40001/src/pkg/syscall/syscall_linux.go#newcode355 > ...
10 years ago (2014-04-03 16:10:04 UTC) #8
rsc
10 years ago (2014-04-17 02:49:29 UTC) #9
R=close

I think it's too late for 1.3. Feel free to hg mail after 1.3 for 1.4.
The more I look at this the less sure I am that we need to do anything. It seems
like it might be a feature that "" prints as "@".

If we do want to change it, this seems like a simpler CL:

g% hg diff
diff -r 3f2fed7c0a19 src/pkg/net/unix_test.go
--- a/src/pkg/net/unix_test.go	Wed Apr 16 22:43:44 2014 -0400
+++ b/src/pkg/net/unix_test.go	Wed Apr 16 22:49:16 2014 -0400
@@ -256,9 +256,6 @@
 			t.Fatalf("UnixConn.Write failed: %v", err)
 		}
 
-		if runtime.GOOS == "linux" && laddr == "" {
-			laddr = "@" // autobind feature
-		}
 		var connAddrs = [3]struct{ got, want Addr }{
 			{ln.Addr(), ta},
 			{c.LocalAddr(), &UnixAddr{Name: laddr, Net: "unix"}},
@@ -308,9 +305,6 @@
 			}
 		}()
 
-		if runtime.GOOS == "linux" && laddr == "" {
-			laddr = "@" // autobind feature
-		}
 		var connAddrs = [4]struct{ got, want Addr }{
 			{c1.LocalAddr(), ta},
 			{c1.RemoteAddr(), nil},
diff -r 3f2fed7c0a19 src/pkg/syscall/syscall_linux.go
--- a/src/pkg/syscall/syscall_linux.go	Wed Apr 16 22:43:44 2014 -0400
+++ b/src/pkg/syscall/syscall_linux.go	Wed Apr 16 22:49:16 2014 -0400
@@ -352,7 +352,7 @@
 	case AF_UNIX:
 		pp := (*RawSockaddrUnix)(unsafe.Pointer(rsa))
 		sa := new(SockaddrUnix)
-		if pp.Path[0] == 0 {
+		if pp.Path[0] == 0 && pp.Path[1] != 0 {
 			// "Abstract" Unix domain socket.
 			// Rewrite leading NUL as @ for textual display.
 			// (This is the standard convention.)
g%
Sign in to reply to this message.

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