Bug#975100: zeromq3: FTBFS on hurd-i386

2020-11-19 Thread Luca Boccassi
On Thu, 2020-11-19 at 00:00 +0100, Svante Signell wrote:
> 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!

Hi Svante,

Thanks for the fixes - I'd like to apply them upstream, but I see we
don't have a relicense grant from you (we are working hard to change
from a custom LGPL3 + static exception to standard MPL2) - could you
please either send a PR including a grant, or attach a grant to an
email so I can apply everything?

You can find the text of the grant to copy/paste and fill here:

https://github.com/zeromq/libzmq/blob/master/RELICENSE/README.md

-- 
Kind regards,
Luca Boccassi


signature.asc
Description: This is a digitally signed message part


Bug#975100: zeromq3: FTBFS on hurd-i386

2020-11-18 Thread Svante Signell
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.0 +0100
+++ b/debian/rules	2020-11-18 20:04:36.0 +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, "tmpXX");
+char *buffer = NULL;
+size_t len = 10;
+buffer = (char*) malloc(len);
+strncpy (buffer, "tmpXX", 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 *) ).sun_path);
+buffer = (char *)realloc (buffer, len);
 strcpy ((*(struct sockaddr_un *) ).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