This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author anthonypjshaw
Recipients anthonypjshaw, pitrou, soutys
Date 2019-05-09.07:49:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1557388198.09.0.89715156134.issue25541@roundup.psfhosted.org>
In-reply-to
Content
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 requirement you've noticed:

 When binding a socket to a pathname, a few rules should be observed
       for maximum portability and ease of coding:

       *  The pathname in sun_path should be null-terminated.

       *  The length of the pathname, including the terminating null byte,
          should not exceed the size of sun_path.

       *  The addrlen argument that describes the enclosing sockaddr_un
          structure should have a value of at least:

              offsetof(struct sockaddr_un, sun_path)+strlen(addr.sun_path)+1

          or, more simply, addrlen can be specified as sizeof(struct sock‐
          addr_un).
History
Date User Action Args
2019-05-09 07:49:58anthonypjshawsetrecipients: + anthonypjshaw, pitrou, soutys
2019-05-09 07:49:58anthonypjshawsetmessageid: <1557388198.09.0.89715156134.issue25541@roundup.psfhosted.org>
2019-05-09 07:49:58anthonypjshawlinkissue25541 messages
2019-05-09 07:49:57anthonypjshawcreate