[issue25541] Wrong usage of sockaddr_un struct for abstract namespace unix sockets

2019-05-09 Thread anthony shaw
anthony shaw added the comment: The existing tests in place add the null-termination bytes in the test string: def testLinuxAbstractNamespace(self): address = b"\x00python-test-hello\x00\xff" with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as s1: s1.bind(

[issue25541] Wrong usage of sockaddr_un struct for abstract namespace unix sockets

2019-05-09 Thread anthony shaw
Change by anthony shaw : -- versions: +Python 3.8 -Python 2.7, Python 3.4, Python 3.7 ___ Python tracker ___ ___ Python-bugs-list ma

[issue25541] Wrong usage of sockaddr_un struct for abstract namespace unix sockets

2019-05-09 Thread anthony shaw
anthony shaw added the comment: thanks, your code example zero-pads the socket address, and looking at the socketmodule.c code it does some padding under certain circumstances. https://github.com/python/cpython/blob/master/Modules/socketmodule.c#L1318-L1330 The Unix man page specify the same

[issue25541] Wrong usage of sockaddr_un struct for abstract namespace unix sockets

2019-05-06 Thread PrzemeK
PrzemeK added the comment: Gist: https://gist.github.com/soutys/ffbe2e76a86835a9cc6b More: Padding `sun_path` with zeros for python cli code: ... client = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) client.connect("\0/var/tmp/sock.tmp" + "\0" * 90) ... gives strace like: ... socket(A

[issue25541] Wrong usage of sockaddr_un struct for abstract namespace unix sockets

2019-05-06 Thread PrzemeK
PrzemeK added the comment: Yep, it was 3.4 then... but I think problem still exists tl;dr: For abstract sockets (only?) filling struct with zeros is meaningful. long: * Python (cli) -> Python (srv) = works * C (cli) -> C (srv) = works * C (cli) -> Python (srv) = does NOT work * Python (cli)

[issue25541] Wrong usage of sockaddr_un struct for abstract namespace unix sockets

2019-05-06 Thread Stefan Behnel
Change by Stefan Behnel : -- nosy: -scoder ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue25541] Wrong usage of sockaddr_un struct for abstract namespace unix sockets

2019-05-06 Thread Stefan Behnel
Stefan Behnel added the comment: Looks like the issue was originally reported against Python 3.4. -- ___ Python tracker ___ ___ Pyt

[issue25541] Wrong usage of sockaddr_un struct for abstract namespace unix sockets

2019-05-06 Thread anthony shaw
anthony shaw added the comment: hi, which version of Python were you using to do this? Please could you provide the full code snippet to reproduce the issue. The following example binds to the correct namespace from socket import * sock = socket(AF_UNIX, SOCK_STREAM) sock.bind("\0/va

[issue25541] Wrong usage of sockaddr_un struct for abstract namespace unix sockets

2015-11-06 Thread Terry J. Reedy
Changes by Terry J. Reedy : -- nosy: +pitrou ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pytho

[issue25541] Wrong usage of sockaddr_un struct for abstract namespace unix sockets

2015-11-03 Thread PrzemeK
PrzemeK added the comment: Errata - 1st paragraph should be: The code that does not work (python3 example): ... sock_path = b"/var/tmp/sock.tmp" server.bind(b"\0" + sock_path) ... and strace shows: bind(3, {sa_family=AF_LOCAL, sun_path=@"/var/tmp/sock.tmp"...}, 20) = 0 -- _

[issue25541] Wrong usage of sockaddr_un struct for abstract namespace unix sockets

2015-11-03 Thread PrzemeK
New submission from PrzemeK: Case: http://stackoverflow.com/questions/33465094/connection-refused-when-using-abstract-namespace-unix-sockets The code that does not work (python3 example): ... sock_path = b"/var/tmp/sock.tmp" server.bind(b"\0" + sock_path) ... and strace shows: connect(3, {sa_fa

[issue25541] Wrong usage of sockaddr_un struct for abstract namespace unix sockets

2015-11-03 Thread PrzemeK
Changes by PrzemeK : -- components: IO, Library (Lib) nosy: soutys priority: normal severity: normal status: open title: Wrong usage of sockaddr_un struct for abstract namespace unix sockets type: behavior versions: Python 2.7, Python 3.4 ___ Python t