Source: zeromq3
Version: 4.3.3-3
Severity: important
Tags: ftbfs, patch
User: debian-h...@lists.debian.org
Usertags: hurd

Hello,

zeromq3 fails to build from source due to a PATH_MAX issue in
tests/testutil.cpp, and a missing declaration of
make_random_ipc_endpoint in tests/testutil_unity.{hpp,cpp}

Additionally, since 4 tests are XFAIL the patch debian_rules.diff is
needed for a proper build.

Build-tested on GNU/Linux and GNU/Hurd.

Thanks!
--- a/debian/rules	2019-01-26 13:49:45.000000000 +0100
+++ b/debian/rules	2020-11-18 20:04:36.000000000 +0100
@@ -6,7 +6,7 @@
 
 export TEST_VERBOSE=1
 
-ifeq ($(DEB_BUILD_ARCH_OS), kfreebsd)
+ifneq (, filter $(DEB_BUILD_ARCH_OS), kfreebsd hurd)
 	DO_TEST = no
 endif
 
Index: zeromq3-4.3.3/tests/testutil.cpp
===================================================================
--- zeromq3-4.3.3.orig/tests/testutil.cpp
+++ zeromq3-4.3.3/tests/testutil.cpp
@@ -476,10 +476,14 @@ fd_t bind_socket_resolve_port (const cha
         TEST_ASSERT_SUCCESS_RAW_ERRNO (_mkdir (buffer));
         strcat (buffer, "/ipc");
 #else
-        char buffer[PATH_MAX] = "";
-        strcpy (buffer, "tmpXXXXXX");
+        char *buffer = NULL;
+        size_t len = 10;
+        buffer = (char*) malloc(len);
+        strncpy (buffer, "tmpXXXXXX", len);
 #ifdef HAVE_MKDTEMP
         TEST_ASSERT_TRUE (mkdtemp (buffer));
+        len += 7;
+        buffer = (char *)realloc (buffer, len);
         strcat (buffer, "/socket");
 #else
         int fd = mkstemp (buffer);
@@ -487,12 +491,17 @@ fd_t bind_socket_resolve_port (const cha
         close (fd);
 #endif
 #endif
+        len += strlen((*(struct sockaddr_un *) &addr).sun_path);
+        buffer = (char *)realloc (buffer, len);
         strcpy ((*(struct sockaddr_un *) &addr).sun_path, buffer);
         memcpy (my_endpoint_, "ipc://", 7);
-        strcat (my_endpoint_, buffer);
+        len += strlen(my_endpoint_);
+        buffer = (char *)realloc (buffer, len);
+        strncat (my_endpoint_, buffer, len);
 
         // TODO check return value of unlink
         unlink (buffer);
+        free (buffer);
 #else
         return retired_fd;
 #endif
Index: zeromq3-4.3.3/tests/testutil_unity.cpp
===================================================================
--- zeromq3-4.3.3.orig/tests/testutil_unity.cpp
+++ zeromq3-4.3.3/tests/testutil_unity.cpp
@@ -298,7 +298,7 @@ void bind_loopback_tipc (void *socket_,
     test_bind (socket_, "tipc://<*>", my_endpoint_, len_);
 }
 
-#if defined(ZMQ_HAVE_IPC) && !defined(ZMQ_HAVE_GNU)
+#if defined(ZMQ_HAVE_IPC)
 void make_random_ipc_endpoint (char *out_endpoint_)
 {
 #ifdef ZMQ_HAVE_WINDOWS
Index: zeromq3-4.3.3/tests/testutil_unity.hpp
===================================================================
--- zeromq3-4.3.3.orig/tests/testutil_unity.hpp
+++ zeromq3-4.3.3/tests/testutil_unity.hpp
@@ -272,7 +272,7 @@ void bind_loopback_ipc (void *socket_, c
 // Binds to an ipc endpoint using the tipc wildcard address.
 void bind_loopback_tipc (void *socket_, char *my_endpoint_, size_t len_);
 
-#if defined(ZMQ_HAVE_IPC) && !defined(ZMQ_HAVE_GNU)
+#if defined(ZMQ_HAVE_IPC)
 // utility function to create a random IPC endpoint, similar to what a ipc://*
 // wildcard binding does, but in a way it can be reused for multiple binds
 // TODO also add a len parameter here

Reply via email to