Garbage data in UNIXSocket path #4247

Closed
etehtsea opened this Issue Oct 26, 2016 · 1 comment

Projects

None yet

2 participants

@etehtsea
Contributor

#4221 regression.

     [exec] Failure: test_can_create_socket_server_and_client_connected_to_it_and_send_from_client_to_server_using_recvfrom(UNIXSocketTests)
     [exec] /home/travis/build/jruby/jruby/test/jruby/test_socket.rb:494:in `test_can_create_socket_server_and_client_connected_to_it_and_send_from_client_to_server_using_recvfrom'
     [exec]      491:         cli = UNIXSocket.open(path)
     [exec]      492:         servsock = sock.accept
     [exec]      493:         cli.send("hello",0)
     [exec]   => 494:         assert_equal ["hello", ["AF_UNIX", ""]], servsock.recvfrom(5)
     [exec]      495:         servsock.close
     [exec]      496:         cli.close
     [exec]      497:         sock.close
     [exec] <["hello", ["AF_UNIX", ""]]> expected but was
     [exec] <["hello", ["AF_UNIX", "��"]]>
     [exec] 
     [exec] diff:
     [exec] ? ["hello", ["AF_UNIX", "��"]]
     [exec] ===============================================================================
     [exec] Failure: test_can_create_socketpair_and_can_send_from_the_other_with_recvfrom(UNIXSocketTests)
     [exec] /home/travis/build/jruby/jruby/test/jruby/test_socket.rb:542:in `test_can_create_socketpair_and_can_send_from_the_other_with_recvfrom'
     [exec]      539:         sock1, sock2 = UNIXSocket.socketpair
     [exec]      540: 
     [exec]      541:         sock2.send("hello", 0)
     [exec]   => 542:         assert_equal ["hello", ["AF_UNIX", ""]], sock1.recvfrom(5)
     [exec]      543: 
     [exec]      544:         sock2.close
     [exec]      545:         sock1.close
     [exec] <["hello", ["AF_UNIX", ""]]> expected but was
     [exec] <["hello", ["AF_UNIX", "# \u0017\u007F"]]>
     [exec] 
     [exec] diff:
     [exec] ? ["hello", ["AF_UNIX", "# \u0017\u007F"]]
     [exec] ===============================================================================
     [exec] Failure: test_unix_socket_peeraddr(UNIXSocketTests)
     [exec] /home/travis/build/jruby/jruby/test/jruby/test_socket.rb:334:in `test_unix_socket_peeraddr'
     [exec]      331: 
     [exec]      332:        ssrv = server.accept
     [exec]      333: 
     [exec]   => 334:        assert_equal ["AF_UNIX", ""], ssrv.peeraddr
     [exec]      335:        # TODO doesn't work as expected :
     [exec]      336:        pend "UNIXSocket#peeraddr #{cli.peeraddr.inspect} does not include path: #{path.inspect}"
     [exec]      337:        assert_equal ["AF_UNIX", path], cli.peeraddr
     [exec] <["AF_UNIX", ""]> expected but was
     [exec] <["AF_UNIX", "��"]>
     [exec] 
     [exec] diff:
     [exec] ? ["AF_UNIX", "��"]
     [exec] 
@etehtsea etehtsea added a commit to etehtsea/jnr-unixsocket that referenced this issue Oct 26, 2016
@etehtsea etehtsea Fix unnamed sockets support
getsockname/getpeername/accept shouldn't inspect path for unnamed
sockets. See https://linux.die.net/man/7/unix
Fixes jruby/jruby#4247
99cba0b
@etehtsea etehtsea referenced this issue in jnr/jnr-unixsocket Oct 26, 2016
Merged

Fix unnamed sockets support #34

@etehtsea etehtsea added a commit to etehtsea/jnr-unixsocket that referenced this issue Oct 26, 2016
@etehtsea etehtsea Fix unnamed sockets support
getsockname/getpeername/accept shouldn't inspect path for unnamed
sockets. See https://linux.die.net/man/7/unix
Fixes jruby/jruby#4247
7901497
@etehtsea
Contributor

Opened PR with fix in jnr-unixsocket repo.

@etehtsea etehtsea added a commit to etehtsea/jnr-unixsocket that referenced this issue Oct 26, 2016
@etehtsea etehtsea Fix unnamed sockets support
getsockname/getpeername/accept shouldn't inspect path for unnamed
sockets. See https://linux.die.net/man/7/unix
Fixes jruby/jruby#4247
12447d3
@enebo enebo reopened this Oct 26, 2016
@enebo enebo closed this in 327fe55 Oct 26, 2016
@enebo enebo added this to the JRuby 9.1.6.0 milestone Nov 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment