Hello,
Currently libqb FTBFS on linux-amd64 for test ipc.test with git sources with
gcc-4.9.1-16. It does not with the current compiler gcc-5.3.1-8, though.
However, I think there is a need to fix the sources also in upstream git.
The attached patch, fix_ipc_setup_bug.patch, patch fixes writing of the
*.sun_path socket names to become non-zero for bind() and connect().
The previous race condition is back for the ipc_stress_connections_us
test. Adding the unlink statement solves this problem (unknown how,
since res=-1 due to ENOENT: No such file or directory.)
This patch and problem was reported to Debian in bug #803866, see
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=803776
Applying this patch the testsuite still pass all tests.
This patch is made against current git and conflicts with the GNU/Hurd patch.
The following *.rej files are created:
hurd patch first, linux patch after:
--- lib/ipc_setup.c
+++ lib/ipc_setup.c
@@ -395,7 +395,7 @@ qb_ipcs_us_publish(struct qb_ipcs_servic
qb_util_log(LOG_INFO, "server name: %s", s->name);
#if defined(QB_LINUX) || defined(QB_CYGWIN)
- snprintf(un_addr.sun_path + 1, UNIX_PATH_MAX - 1, "%s", s->name);
+ snprintf(un_addr.sun_path, sizeof(un_addr.sun_path), "%s", s->name);
#else
{
struct stat stat_out;
linux patch first, hurd patch after:
--- lib/ipc_setup.c
+++ lib/ipc_setup.c
@@ -394,7 +394,7 @@ qb_ipcs_us_publish(struct qb_ipcs_servic
#endif
qb_util_log(LOG_INFO, "server name: %s", s->name);
-#if defined(QB_LINUX) || defined(QB_CYGWIN)
+#if defined(QB_LINUX) || defined(QB_CYGWIN) || defined(QB_GNU)
snprintf(un_addr.sun_path + 1, UNIX_PATH_MAX - 1, "%s", s->name);
#else
{
In case you consider applying the proposed patches, please let me know so I can
fix the conflicts.
Thanks!diff --git a/lib/ipc_setup.c b/lib/ipc_setup.c
index 700de94..70c735b 100644
--- a/lib/ipc_setup.c
+++ b/lib/ipc_setup.c
@@ -286,7 +286,7 @@ qb_ipcc_stream_sock_connect(const char *socket_name, int32_t * sock_pt)
#endif
#if defined(QB_LINUX) || defined(QB_CYGWIN)
- snprintf(address.sun_path + 1, UNIX_PATH_MAX - 1, "%s", socket_name);
+ snprintf(address.sun_path, sizeof(address.sun_path), "%s", socket_name);
#else
snprintf(address.sun_path, sizeof(address.sun_path), "%s/%s", SOCKETDIR,
socket_name);
@@ -535,7 +535,7 @@ qb_ipcs_us_publish(struct qb_ipcs_service * s)
qb_util_log(LOG_INFO, "server name: %s", s->name);
#if defined(QB_LINUX) || defined(QB_CYGWIN)
- snprintf(un_addr.sun_path + 1, UNIX_PATH_MAX - 1, "%s", s->name);
+ snprintf(un_addr.sun_path, sizeof(un_addr.sun_path), "%s", s->name);
#else
{
struct stat stat_out;
diff --git a/lib/ipc_socket.c b/lib/ipc_socket.c
index e4a2606..0f7ab97 100644
--- a/lib/ipc_socket.c
+++ b/lib/ipc_socket.c
@@ -51,7 +51,7 @@ set_sock_addr(struct sockaddr_un *address, const char *socket_name)
#endif
#if defined(QB_LINUX) || defined(QB_CYGWIN)
- snprintf(address->sun_path + 1, UNIX_PATH_MAX - 1, "%s", socket_name);
+ snprintf(address->sun_path, sizeof(address->sun_path), "%s", socket_name);
#else
snprintf(address->sun_path, sizeof(address->sun_path), "%s/%s", SOCKETDIR,
socket_name);
@@ -83,6 +83,8 @@ qb_ipc_dgram_sock_setup(const char *base_name,
#if !(defined(QB_LINUX) || defined(QB_CYGWIN))
res = unlink(local_address.sun_path);
#endif
+ /* Note: This makes the race go away even if res=-1 due to ENOENT */
+ res = unlink(local_address.sun_path);
res = bind(request_fd, (struct sockaddr *)&local_address,
sizeof(local_address));
#if !(defined(QB_LINUX) || defined(QB_CYGWIN))
_______________________________________________
Developers mailing list
[email protected]
http://clusterlabs.org/mailman/listinfo/developers