-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: pipe_overlong_path fails on AIX #4231
Comments
What is the size of |
Looks like its set to 1024 or 1023 From: #if defined(COMPAT_43) && !defined(_KERNEL)
struct sockaddr_un {
ushort_t sun_family; /* AF_UNIX */
char sun_path[1024]; /* changed from 104 to PATH_MAX to support long user names. This value should be ch
anged manually if PATH_MAX changes in future */
};
#else
struct sockaddr_un {
uchar_t sun_len; /* sockaddr len including null */
sa_family_t sun_family; /* AF_UNIX */
char sun_path[1023]; /* changed from 104 to PATH_MAX to support long user names. This value should be ch
anged manually if PATH_MAX changes in future */
};
#endif /* COMPAT_43 && !_KERNEL */ |
I got around to adding some debug print statements to get a better understanding of what is going on. My changes are here for ref: https://github.com/libuv/libuv/compare/v1.x...abmusse:libuv:debug-pipe-overlong-path?expand=1
ref: https://ci.nodejs.org/job/libuv-test-commit-aix/nodes=aix72-ppc64/lastBuild/console I confirmed that The namelen being passed in test case is 512 which is why its skipping the check Lines 84 to 86 in 6be130e
The weird part is that bind fails when setting saddr.sun_path to the long name. Lines 116 to 127 in 6be130e
We get back errno 86 which looks like it maps to ENAMETOOLONG on AIX. From my previous comment: #if defined(COMPAT_43) && !defined(_KERNEL)
struct sockaddr_un {
ushort_t sun_family; /* AF_UNIX */
char sun_path[1024]; /* changed from 104 to PATH_MAX to support long user names. This value should be ch
anged manually if PATH_MAX changes in future */
};
#else
struct sockaddr_un {
uchar_t sun_len; /* sockaddr len including null */
sa_family_t sun_family; /* AF_UNIX */
char sun_path[1023]; /* changed from 104 to PATH_MAX to support long user names. This value should be ch
anged manually if PATH_MAX changes in future */
};
#endif /* COMPAT_43 && !_KERNEL */ It seems like on AIX sun_path was increased from support for long user names? I think we need to find the true max allowed name length for a socket since the current sun_path of 1023 looks too big. |
As a follow up I made a re-producible program in C // unix-sock.c
// gcc -o unix-sock unix-sock.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/un.h>
int main() {
int sockfd;
struct sockaddr_un addr;
printf( "addr.sun_path: %lu\n\n", sizeof(addr.sun_path));
char SOCKET_PATH[512];
memset(SOCKET_PATH, '@', sizeof(SOCKET_PATH));
// Create a Unix domain socket
sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
if (sockfd == -1) {
perror("socket");
exit(EXIT_FAILURE);
}
// Clear the structure
memset(&addr, 0, sizeof(struct sockaddr_un));
// Assign the socket family and the socket path
addr.sun_family = AF_UNIX;
strncpy(addr.sun_path, SOCKET_PATH, sizeof(addr.sun_path) - 1);
// Bind the socket
if (bind(sockfd, (struct sockaddr *)&addr, sizeof(struct sockaddr_un)) == -1) {
perror("bind");
close(sockfd);
exit(EXIT_FAILURE);
}
printf("Socket bound to %s\n", SOCKET_PATH);
close(sockfd);
return 0;
} I then compiled and ran it on AIX: $ gcc -o unix-sock unix-sock.c
$ ./unix-sock
addr.sun_path: 1023
bind: File name too long For fun I then compiled and ran it on IBM i to see if there would be a diff in behavior: $ gcc -o unix-sock unix-sock.c
$ ./unix-sock
addr.sun_path: 126
Socket bound to @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ There is a def a diff in behavior in relation to File name max length. |
Discovered this failure while running the CI for a pull request:
Ref: #4229
https://ci.nodejs.org/job/libuv-test-commit-aix/nodes=aix72-ppc64/2279/console
libuv/test/test-pipe-bind-error.c
Line 175 in 6be130e
Looks like errno 86 maps to
ENAMETOOLONG
on AIX.Looks like this passes as expected on IBM i:
https://ci.nodejs.org/job/libuv-test-commit-aix/nodes=aix72-ppc64/2279/console
The text was updated successfully, but these errors were encountered: