Fixed off-by-one error in checking length of abstract namespace Unix sockets#14483
Conversation
|
The way I'm reading https://man7.org/linux/man-pages/man7/unix.7.html it seems that the I'm specifically referring to the section "Three types of address are distinguished in the sockaddr_un structure:"
This means that we must take into account the space for the NUL terminator in the case of a non-abstract namespace socket. EDIT: I think you need something like this instead https://gist.github.com/nielsdos/ee33321f88632a8c228e6d3c0efcdf5b |
|
I read it the same way as @nielsdos, his Gist looks correct to me. |
8c2b70f to
9f005f8
Compare
| Bug #60106 (stream_socket_server with abstract unix unix socket paths) | ||
| --SKIPIF-- | ||
| <?php | ||
| if( substr(PHP_OS, 0, 3) == "WIN" ) |
There was a problem hiding this comment.
It doesn't seem like either macOS nor FreeBSD support abstract socket names. So you should likely skip this test for everything but Linux.
There was a problem hiding this comment.
Yes, I forgot about that. I'm sad that OSX/FBSD don't support it though.
9f005f8 to
ad56ec7
Compare
I was trying to use PHP to talk to Xdebug's new out-of-band control sockets, which use the abstract Unix domain socket namespace (socket names starting with a
\0character).Xdebug uses names that are the maximum allowed length for these socket names (108 bytes).
However, when I tried to run:
I got the following output and error:
But the path is exactly 108 characters, not more. It turned out that the check for this maximum length is wrong.
No new test can easily be created, as the
108is implementation specific, andext/standard/tests/streams/bug60106.phptalready covers it.With this change, I can now correctly connection to these sockets.