Bug#799235: zeromq3: Patch for GNU/Hurd support

2016-02-16 Thread GCS
On Mon, Feb 15, 2016 at 11:28 PM, Samuel Thibault  wrote:
> Is there any update on this?
 It needs a transition of libpgm, which was collided with the
libsodium transition. As the latter is over in the last two days, I'm
going to start the former this afternoon.

Thanks for the heads-up,
Laszlo/GCS



Bug#799235: zeromq3: Patch for GNU/Hurd support

2016-02-15 Thread Samuel Thibault
Hello,

Is there any update on this?

sid has been uninstallable for months for hurd-i386 due to this issue
(the rsyslog rdeps is still missing a rebuild against newer libs), it'd
be really good that we get this fixed at some point.

Thanks,
Samuel



Bug#799235: zeromq3: Patch for GNU/Hurd support

2016-01-19 Thread Svante Signell
On Tue, 2015-10-06 at 12:33 +0200, Svante Signell wrote:
> tags 799235 patch
> usertag 799235 hurd
> user debian-h...@lists.debian.org
> thanks
> 
> Source: zeromq3
> Version: 4.0.5+dfsg-3
> Severity: important
> Justification: fails to build from source
> 
> Hello,
> 
> The attached patch adds support for zeromq3 on GNU/Hurd. Two tests
> fails causing ssh to hang and crashes a translator in a hurd terminal:
> test_pair_ipc and test_reqrep_ipc. Partial problems with these tests
> are that option SO_ERROR is not yet supported for gsetsockopt() on
> Hurd.
> 
> Investigation is ongoing. This is reflected in tests/Makefile.am which
> excludes these tests.

Now fixed!

Attached is an updated patch not containing the commented-out code. Regarding
SO_ERROR for local sockets Hurd is now updated not to issue an error. However,
the test for ENOPROTOOPT should probably still be there, for reasons given by
Samuel in issue 1709. Seems like the old patch got applied to the github code,
see issue 1704 and pull request 1709. Since I don't know anything about github
pull requests, maybe you can handle this?

Additionally, until upstream makes a new release, do you think it is possible to
add the patch to the Debian package so that packages reverse-depending on it can
be built?

Thanks!
Index: zeromq3-4.0.5+dfsg/configure.ac
===
--- zeromq3-4.0.5+dfsg.orig/configure.ac
+++ zeromq3-4.0.5+dfsg/configure.ac
@@ -115,6 +115,7 @@ libzmq_dso_visibility="yes"
 libzmq_on_mingw32="no"
 libzmq_on_android="no"
 libzmq_on_linux="no"
+libzmq_on_gnu="no"
 
 # Set some default features required by 0MQ code.
 CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE $CPPFLAGS"
@@ -249,6 +250,15 @@ case "${host_os}" in
 AC_MSG_ERROR([Building static libraries is not supported under Cygwin])
 fi
 ;;
+gnu*)
+# Define on GNU/Hurd to enable all library features. Define if using a gnu compiler
+if test "x$GXX" = "xyes"; then
+CPPFLAGS="-D_GNU_SOURCE $CPPFLAGS"
+fi
+AC_DEFINE(ZMQ_HAVE_GNU, 1, [Have GNU/Hurd OS])
+libzmq_on_gnu="yes"
+	AC_CHECK_LIB(rt, sem_init)
+;;
 *)
 AC_MSG_ERROR([unsupported system: ${host_os}.])
 ;;
@@ -431,6 +441,7 @@ AM_CONDITIONAL(BUILD_PGM, test "x$libzmq
 AM_CONDITIONAL(ON_MINGW, test "x$libzmq_on_mingw32" = "xyes")
 AM_CONDITIONAL(ON_ANDROID, test "x$libzmq_on_android" = "xyes")
 AM_CONDITIONAL(ON_LINUX, test "x$libzmq_on_linux" = "xyes")
+AM_CONDITIONAL(ON_GNU, test "x$libzmq_on_gnu" = "xyes")
 
 # Checks for library functions.
 AC_TYPE_SIGNAL
Index: zeromq3-4.0.5+dfsg/src/poller.hpp
===
--- zeromq3-4.0.5+dfsg.orig/src/poller.hpp
+++ zeromq3-4.0.5+dfsg/src/poller.hpp
@@ -73,6 +73,9 @@
 #elif defined ZMQ_HAVE_CYGWIN
 #define ZMQ_USE_SELECT
 #include "select.hpp"
+#elif defined ZMQ_HAVE_GNU
+#define ZMQ_USE_POLL
+#include "poll.hpp"
 #else
 #error Unsupported platform
 #endif
Index: zeromq3-4.0.5+dfsg/src/ipc_connecter.cpp
===
--- zeromq3-4.0.5+dfsg.orig/src/ipc_connecter.cpp
+++ zeromq3-4.0.5+dfsg/src/ipc_connecter.cpp
@@ -242,8 +242,11 @@ zmq::fd_t zmq::ipc_connecter_t::connect
 socklen_t len = sizeof (err);
 #endif
 int rc = getsockopt (s, SOL_SOCKET, SO_ERROR, (char*) , );
-if (rc == -1)
+if (rc == -1) {
+if (errno == ENOPROTOOPT)
+	errno = 0;
 err = errno;
+}
 if (err != 0) {
 
 //  Assert if the error was caused by 0MQ bug.
Index: zeromq3-4.0.5+dfsg/src/zmq.cpp
===
--- zeromq3-4.0.5+dfsg.orig/src/zmq.cpp
+++ zeromq3-4.0.5+dfsg/src/zmq.cpp
@@ -28,7 +28,7 @@
 defined ZMQ_HAVE_OPENBSD || defined ZMQ_HAVE_SOLARIS ||\
 defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_QNXNTO ||\
 defined ZMQ_HAVE_HPUX || defined ZMQ_HAVE_AIX ||\
-defined ZMQ_HAVE_NETBSD
+defined ZMQ_HAVE_NETBSD || defined ZMQ_HAVE_GNU
 #define ZMQ_POLL_BASED_ON_POLL
 #elif defined ZMQ_HAVE_WINDOWS || defined ZMQ_HAVE_OPENVMS ||\
  defined ZMQ_HAVE_CYGWIN
Index: zeromq3-4.0.5+dfsg/src/proxy.cpp
===
--- zeromq3-4.0.5+dfsg.orig/src/proxy.cpp
+++ zeromq3-4.0.5+dfsg/src/proxy.cpp
@@ -30,7 +30,7 @@
 defined ZMQ_HAVE_OPENBSD || defined ZMQ_HAVE_SOLARIS ||\
 defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_QNXNTO ||\
 defined ZMQ_HAVE_HPUX || defined ZMQ_HAVE_AIX ||\
-defined ZMQ_HAVE_NETBSD
+defined ZMQ_HAVE_NETBSD || defined ZMQ_HAVE_GNU
 #define ZMQ_POLL_BASED_ON_POLL
 #elif defined ZMQ_HAVE_WINDOWS || defined ZMQ_HAVE_OPENVMS ||\
  defined ZMQ_HAVE_CYGWIN
Index: zeromq3-4.0.5+dfsg/src/signaler.cpp
===
--- zeromq3-4.0.5+dfsg.orig/src/signaler.cpp
+++ zeromq3-4.0.5+dfsg/src/signaler.cpp
@@ -27,7 +27,7 @@
 

Bug#799235: zeromq3: Patch for GNU/Hurd support

2016-01-19 Thread Svante Signell
On Tue, 2016-01-19 at 22:31 +0100, Svante Signell wrote:
> On Tue, 2016-01-19 at 14:14 +, László Böszörményi (GCS) wrote:
> > On Tue, Jan 19, 2016 at 2:13 PM, Svante Signell
> > 
> >  So should I wait for further fixes (those will happen in some hours /
> > days) or submit this as-is to upstream?
> 
> Additionally, the patch hurd-support_update.patch is made
> against the git master version. I don't know yet if it builds since upstream
> does not have a debian/ directory, and it is not yet packaged for Debian.

Update, I did manually issue configure, make and make check in the git
directory, and they passed fine. It seems like even the git version, 4.2.0?,
 should build when packaged.



Bug#799235: zeromq3: Patch for GNU/Hurd support

2016-01-19 Thread Svante Signell
On Tue, 2016-01-19 at 14:14 +, László Böszörményi (GCS) wrote:
> On Tue, Jan 19, 2016 at 2:13 PM, Svante Signell
>  wrote:
> > On Tue, 2016-01-19 at 13:05 +0100, Svante Signell wrote:
> > > Additionally, until upstream makes a new release, do you think it is
> > > possible
> > > to add the patch to the Debian package so that packages reverse-depending
> > > on
> > > it can be built?
>  Sure, I'll use it for the next upload.
> 
> > Hello again, attached is an updated patch based on master at github. With
> > these
> > modifications also version 4.1.2 from experimental almost builds. Some
> > further
> > patches are needed for a successful build and the testsuite to pass.
>  So should I wait for further fixes (those will happen in some hours /
> days) or submit this as-is to upstream?

Hello,

Attached is a patch, hurd-support_4.1.2.patch, making the Debian version 4.1.2
to build properly. Additionally, the patch hurd-support_update.patch is made
against the git master version. I don't know yet if it builds since upstream
does not have a debian/ directory, and it is not yet packaged for Debian.

Thanks!
Index: zeromq3-4.1.2/configure.ac
===
--- zeromq3-4.1.2.orig/configure.ac
+++ zeromq3-4.1.2/configure.ac
@@ -136,6 +136,7 @@ libzmq_dso_visibility="yes"
 libzmq_on_mingw32="no"
 libzmq_on_android="no"
 libzmq_on_linux="no"
+libzmq_on_gnu="no"
 
 # Set some default features required by 0MQ code.
 CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE $CPPFLAGS"
@@ -273,6 +274,15 @@ case "${host_os}" in
 AC_MSG_ERROR([Building static libraries is not supported under Cygwin])
 fi
 ;;
+gnu*)
+# Define on GNU/Hurd to enable all library features. Define if using a gnu compiler
+if test "x$GXX" = "xyes"; then
+CPPFLAGS="-D_GNU_SOURCE $CPPFLAGS"
+fi
+AC_DEFINE(ZMQ_HAVE_GNU, 1, [Have GNU/Hurd OS])
+libzmq_on_gnu="yes"
+	AC_CHECK_LIB(rt, sem_init)
+;;
 *)
 AC_MSG_ERROR([unsupported system: ${host_os}.])
 ;;
@@ -474,6 +484,7 @@ AM_CONDITIONAL(BUILD_TIPC, test "x$libzm
 AM_CONDITIONAL(ON_MINGW, test "x$libzmq_on_mingw32" = "xyes")
 AM_CONDITIONAL(ON_ANDROID, test "x$libzmq_on_android" = "xyes")
 AM_CONDITIONAL(ON_LINUX, test "x$libzmq_on_linux" = "xyes")
+AM_CONDITIONAL(ON_GNU, test "x$libzmq_on_gnu" = "xyes")
 
 # Checks for library functions.
 AC_TYPE_SIGNAL
Index: zeromq3-4.1.2/src/poller.hpp
===
--- zeromq3-4.1.2.orig/src/poller.hpp
+++ zeromq3-4.1.2/src/poller.hpp
@@ -48,6 +48,9 @@
 #include "poll.hpp"
 #elif defined ZMQ_USE_SELECT
 #include "select.hpp"
+#elif defined ZMQ_HAVE_GNU
+#define ZMQ_USE_POLL
+#include "poll.hpp"
 #else
 #error None of the ZMQ_USE_* macros defined
 #endif
Index: zeromq3-4.1.2/src/ipc_connecter.cpp
===
--- zeromq3-4.1.2.orig/src/ipc_connecter.cpp
+++ zeromq3-4.1.2/src/ipc_connecter.cpp
@@ -252,8 +252,11 @@ zmq::fd_t zmq::ipc_connecter_t::connect
 socklen_t len = sizeof (err);
 #endif
 int rc = getsockopt (s, SOL_SOCKET, SO_ERROR, (char*) , );
-if (rc == -1)
+if (rc == -1) {
+if (errno == ENOPROTOOPT)
+	errno = 0;
 err = errno;
+}
 if (err != 0) {
 
 //  Assert if the error was caused by 0MQ bug.
Index: zeromq3-4.1.2/src/tcp_address.cpp
===
--- zeromq3-4.1.2.orig/src/tcp_address.cpp
+++ zeromq3-4.1.2/src/tcp_address.cpp
@@ -156,7 +156,8 @@ int zmq::tcp_address_t::resolve_nic_name
 
 #elif ((defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_FREEBSD ||\
 defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_OPENBSD ||\
-defined ZMQ_HAVE_QNXNTO || defined ZMQ_HAVE_NETBSD)\
+defined ZMQ_HAVE_QNXNTO || defined ZMQ_HAVE_NETBSD ||\
+defined ZMQ_HAVE_GNU)\
 && defined ZMQ_HAVE_IFADDRS)
 
 #include 
Index: zeromq3-4.1.2/Makefile.am
===
--- zeromq3-4.1.2.orig/Makefile.am
+++ zeromq3-4.1.2/Makefile.am
@@ -588,6 +588,12 @@ if !ON_LINUX
 XFAIL_TESTS += test_abstract_ipc
 endif
 
+if ON_GNU
+XFAIL_TESTS += \
+	test_ipc_wildcard \
+	test_term_endpoint
+endif
+
 EXTRA_DIST = \
 	CMakeLists.txt \
 	autogen.sh	\
Index: zeromq3-4.1.2/src/thread.cpp
===
--- zeromq3-4.1.2.orig/src/thread.cpp
+++ zeromq3-4.1.2/src/thread.cpp
@@ -114,7 +114,7 @@ void zmq::thread_t::stop ()
 
 void zmq::thread_t::setSchedulingParameters(int priority_, int schedulingPolicy_)
 {
-#if !defined ZMQ_HAVE_ZOS
+#if !defined ZMQ_HAVE_ZOS && !defined ZMQ_HAVE_GNU
 int policy = 0;
 struct sched_param param;
 
diff --git a/Makefile.am b/Makefile.am
index 825c3c3..02a96a5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -702,6 +702,11 @@ if !ON_LINUX
 XFAIL_TESTS += 

Bug#799235: zeromq3: Patch for GNU/Hurd support

2016-01-19 Thread Svante Signell
On Tue, 2016-01-19 at 13:05 +0100, Svante Signell wrote:
> On Tue, 2015-10-06 at 12:33 +0200, Svante Signell wrote:
> > tags 799235 patch
> > usertag 799235 hurd
> > user debian-h...@lists.debian.org
> > thanks
> > 
> > Source: zeromq3
> > Version: 4.0.5+dfsg-3
> > Severity: important
> > Justification: fails to build from source

> Additionally, until upstream makes a new release, do you think it is possible
> to add the patch to the Debian package so that packages reverse-depending on
> it can be built?

Hello again, attached is an updated patch based on master at github. With these
modifications also version 4.1.2 from experimental almost builds. Some further
patches are needed for a successful build and the testsuite to pass.

Thanks!diff --git a/configure.ac b/configure.ac
index 589f90d..cbc4017 100644
--- a/configure.ac
+++ b/configure.ac
@@ -146,20 +146,6 @@ CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE $CPPFLAGS"
 # For host type checks
 AC_CANONICAL_HOST
 
-#For a working getsockopt() optname=SO_ERROR
-dnl AC_MSG_CHECKING([for getsockopt optname SO_ERROR)])
-dnl AC_TRY_COMPILE([
-dnl #include 
-dnl #include 
-dnl ], [socklen_t t;], ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no)
-dnl if test "x$ac_cv_type_socklen_t" = "xyes"; then
-dnl AC_MSG_RESULT([yes])
-dnl AC_DEFINE(HAVE_SOCKLEN_T,1,
-dnl   [Define if socklen_t is available])
-dnl   else
-dnl   AC_MSG_RESULT([no])
-dnl   fi
-
 # OS-specific tests
 case "${host_os}" in
 *linux*)
@@ -304,8 +290,6 @@ case "${host_os}" in
 AC_DEFINE(ZMQ_HAVE_GNU, 1, [Have GNU/Hurd OS])
 libzmq_on_gnu="yes"
 	AC_CHECK_LIB(rt, sem_init)
-dnlAC_CHECK_LIB(uuid, uuid_generate, ,
-dnl[AC_MSG_ERROR([cannot link with -luuid, install uuid-dev.])])
 ;;
 *)
 AC_MSG_ERROR([unsupported system: ${host_os}.])
diff --git a/src/poller.hpp b/src/poller.hpp
index f3d8d67..a87d509 100644
--- a/src/poller.hpp
+++ b/src/poller.hpp
@@ -49,12 +49,8 @@
 #elif defined ZMQ_USE_SELECT
 #include "select.hpp"
 #elif defined ZMQ_HAVE_GNU
-#define ZMQ_USE_SELECT
-#include "select.hpp"
-#if 0
 #define ZMQ_USE_POLL
 #include "poll.hpp"
-#endif
 #else
 #error None of the ZMQ_USE_* macros defined
 #endif


Bug#799235: zeromq3: Patch for GNU/Hurd support

2016-01-19 Thread GCS
On Tue, Jan 19, 2016 at 2:13 PM, Svante Signell
 wrote:
> On Tue, 2016-01-19 at 13:05 +0100, Svante Signell wrote:
>> Additionally, until upstream makes a new release, do you think it is possible
>> to add the patch to the Debian package so that packages reverse-depending on
>> it can be built?
 Sure, I'll use it for the next upload.

> Hello again, attached is an updated patch based on master at github. With 
> these
> modifications also version 4.1.2 from experimental almost builds. Some further
> patches are needed for a successful build and the testsuite to pass.
 So should I wait for further fixes (those will happen in some hours /
days) or submit this as-is to upstream?

Cheers,
Laszlo/GCS



Bug#799235: zeromq3: Patch for GNU/Hurd support

2016-01-02 Thread Samuel Thibault
Hello,

Luca Boccassi, on Sat 10 Oct 2015 13:07:26 +0100, wrote:
>  wrote:
> > Two tests fails causing ssh to hang and crashes a translator in a
> > hurd terminal: test_pair_ipc and test_reqrep_ipc. Partial problems
> > with these tests are that option SO_ERROR is not yet supported for
> > gsetsockopt() on Hurd.
> 
> The problem is that SO_ERROR is used by ZMQ to check the status of an
> asynchronous socket connect() [1].

To be more precise, SO_ERROR is completely supported for TCP/IP sockets.
It is not supported for local sockets only.  But this shouldn't be a
problem for zeromq at all since local sockets always either connect
immediately without blocking, or get a refused connection.

Samuel



Bug#799235: zeromq3: Patch for GNU/Hurd support

2016-01-02 Thread Samuel Thibault
Samuel Thibault, on Sun 03 Jan 2016 02:57:31 +0100, wrote:
> Luca Boccassi, on Sat 10 Oct 2015 13:07:26 +0100, wrote:
> >  wrote:
> > > Two tests fails causing ssh to hang and crashes a translator in a
> > > hurd terminal: test_pair_ipc and test_reqrep_ipc. Partial problems
> > > with these tests are that option SO_ERROR is not yet supported for
> > > gsetsockopt() on Hurd.
> > 
> > The problem is that SO_ERROR is used by ZMQ to check the status of an
> > asynchronous socket connect() [1].
> 
> To be more precise, SO_ERROR is completely supported for TCP/IP sockets.
> It is not supported for local sockets only.  But this shouldn't be a
> problem for zeromq at all since local sockets always either connect
> immediately without blocking, or get a refused connection.

Put another way, I believe the attached patch is right: if the
implementation does not support SO_ERROR, then it means it does not
support asynchronous connect and there is no error to read, so assume
success. With that change, the testsuite passes completely without any
issue.

We can also make hurd's local sockets always return 0 from SO_ERROR
since it doesn't have asynchronous connects.

Samuel
Index: zeromq3-4.0.5+dfsg/configure.ac
===
--- zeromq3-4.0.5+dfsg.orig/configure.ac
+++ zeromq3-4.0.5+dfsg/configure.ac
@@ -115,6 +115,7 @@ libzmq_dso_visibility="yes"
 libzmq_on_mingw32="no"
 libzmq_on_android="no"
 libzmq_on_linux="no"
+libzmq_on_gnu="no"
 
 # Set some default features required by 0MQ code.
 CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE $CPPFLAGS"
@@ -122,6 +123,20 @@ CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE $C
 # For host type checks
 AC_CANONICAL_HOST
 
+#For a working getsockopt() optname=SO_ERROR
+dnl AC_MSG_CHECKING([for getsockopt optname SO_ERROR)])
+dnl AC_TRY_COMPILE([
+dnl #include 
+dnl #include 
+dnl ], [socklen_t t;], ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no)
+dnl if test "x$ac_cv_type_socklen_t" = "xyes"; then
+dnl AC_MSG_RESULT([yes])
+dnl AC_DEFINE(HAVE_SOCKLEN_T,1,
+dnl   [Define if socklen_t is available])
+dnl   else
+dnl   AC_MSG_RESULT([no])
+dnl   fi
+
 # OS-specific tests
 case "${host_os}" in
 *linux*)
@@ -249,6 +264,17 @@ case "${host_os}" in
 AC_MSG_ERROR([Building static libraries is not supported under 
Cygwin])
 fi
 ;;
+gnu*)
+# Define on GNU/Hurd to enable all library features. Define if using a 
gnu compiler
+if test "x$GXX" = "xyes"; then
+CPPFLAGS="-D_GNU_SOURCE $CPPFLAGS"
+fi
+AC_DEFINE(ZMQ_HAVE_GNU, 1, [Have GNU/Hurd OS])
+libzmq_on_gnu="yes"
+   AC_CHECK_LIB(rt, sem_init)
+dnlAC_CHECK_LIB(uuid, uuid_generate, ,
+dnl[AC_MSG_ERROR([cannot link with -luuid, install uuid-dev.])])
+;;
 *)
 AC_MSG_ERROR([unsupported system: ${host_os}.])
 ;;
@@ -431,6 +457,7 @@ AM_CONDITIONAL(BUILD_PGM, test "x$libzmq
 AM_CONDITIONAL(ON_MINGW, test "x$libzmq_on_mingw32" = "xyes")
 AM_CONDITIONAL(ON_ANDROID, test "x$libzmq_on_android" = "xyes")
 AM_CONDITIONAL(ON_LINUX, test "x$libzmq_on_linux" = "xyes")
+AM_CONDITIONAL(ON_GNU, test "x$libzmq_on_gnu" = "xyes")
 
 # Checks for library functions.
 AC_TYPE_SIGNAL
Index: zeromq3-4.0.5+dfsg/src/poller.hpp
===
--- zeromq3-4.0.5+dfsg.orig/src/poller.hpp
+++ zeromq3-4.0.5+dfsg/src/poller.hpp
@@ -73,6 +73,13 @@
 #elif defined ZMQ_HAVE_CYGWIN
 #define ZMQ_USE_SELECT
 #include "select.hpp"
+#elif defined ZMQ_HAVE_GNU
+#define ZMQ_USE_SELECT
+#include "select.hpp"
+#if 0
+#define ZMQ_USE_POLL
+#include "poll.hpp"
+#endif
 #else
 #error Unsupported platform
 #endif
Index: zeromq3-4.0.5+dfsg/src/ipc_connecter.cpp
===
--- zeromq3-4.0.5+dfsg.orig/src/ipc_connecter.cpp
+++ zeromq3-4.0.5+dfsg/src/ipc_connecter.cpp
@@ -242,8 +242,11 @@ zmq::fd_t zmq::ipc_connecter_t::connect
 socklen_t len = sizeof (err);
 #endif
 int rc = getsockopt (s, SOL_SOCKET, SO_ERROR, (char*) , );
-if (rc == -1)
+if (rc == -1) {
+if (errno == ENOPROTOOPT)
+   errno = 0;
 err = errno;
+}
 if (err != 0) {
 
 //  Assert if the error was caused by 0MQ bug.
Index: zeromq3-4.0.5+dfsg/src/zmq.cpp
===
--- zeromq3-4.0.5+dfsg.orig/src/zmq.cpp
+++ zeromq3-4.0.5+dfsg/src/zmq.cpp
@@ -28,7 +28,7 @@
 defined ZMQ_HAVE_OPENBSD || defined ZMQ_HAVE_SOLARIS ||\
 defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_QNXNTO ||\
 defined ZMQ_HAVE_HPUX || defined ZMQ_HAVE_AIX ||\
-defined ZMQ_HAVE_NETBSD
+defined ZMQ_HAVE_NETBSD || defined ZMQ_HAVE_GNU
 #define ZMQ_POLL_BASED_ON_POLL
 #elif defined ZMQ_HAVE_WINDOWS || defined ZMQ_HAVE_OPENVMS ||\
  defined ZMQ_HAVE_CYGWIN
Index: zeromq3-4.0.5+dfsg/src/proxy.cpp

Bug#799235: zeromq3: Patch for GNU/Hurd support

2016-01-02 Thread Luca Boccassi
On Jan 3, 2016 03:15, "Samuel Thibault"  wrote:
>
> Samuel Thibault, on Sun 03 Jan 2016 02:57:31 +0100, wrote:
> > Luca Boccassi, on Sat 10 Oct 2015 13:07:26 +0100, wrote:
> > >  wrote:
> > > > Two tests fails causing ssh to hang and crashes a translator in a
> > > > hurd terminal: test_pair_ipc and test_reqrep_ipc. Partial problems
> > > > with these tests are that option SO_ERROR is not yet supported for
> > > > gsetsockopt() on Hurd.
> > >
> > > The problem is that SO_ERROR is used by ZMQ to check the status of an
> > > asynchronous socket connect() [1].
> >
> > To be more precise, SO_ERROR is completely supported for TCP/IP sockets.
> > It is not supported for local sockets only.  But this shouldn't be a
> > problem for zeromq at all since local sockets always either connect
> > immediately without blocking, or get a refused connection.
>
> Put another way, I believe the attached patch is right: if the
> implementation does not support SO_ERROR, then it means it does not
> support asynchronous connect and there is no error to read, so assume
> success. With that change, the testsuite passes completely without any
> issue.

Ah, that changes things of course, very good news! Thanks for checking back!

Only a minor cosmetic question about the patch, what is the purpose of this
if 0 block in poller.hpp:

+#if 0
+#define ZMQ_USE_POLL
+#include "poll.hpp"
+#endif

> We can also make hurd's local sockets always return 0 from SO_ERROR
> since it doesn't have asynchronous connects.

That sounds like a good plan, but perhaps it's best to ask upstream for
comments, my knowledge of the internals is very limited, so their review is
going to be much more helpful :-)

Could you please open a pull request to upstream's dev repo
https://github.com/zeromq/libzmq ? Their support is fantastic, and you can
expect a response (and a merge if it's all right) within hours usually.

Thank you!

Kind regards,
Luca Boccassi


Bug#799235: zeromq3: Patch for GNU/Hurd support

2015-10-10 Thread Luca Boccassi
On Tue, 06 Oct 2015 12:33:29 +0200 Svante Signell
 wrote:
> tags 799235 patch
> usertag 799235 hurd
> user debian-h...@lists.debian.org
> thanks
>
> Source: zeromq3
> Version: 4.0.5+dfsg-3
> Severity: important
> Justification: fails to build from source
>
> Hello,
>
> The attached patch adds support for zeromq3 on GNU/Hurd. Two tests
> fails causing ssh to hang and crashes a translator in a hurd terminal:
> test_pair_ipc and test_reqrep_ipc. Partial problems with these tests
> are that option SO_ERROR is not yet supported for gsetsockopt() on
> Hurd.
>
> Investigation is ongoing. This is reflected in tests/Makefile.am which
> excludes these tests.
>
> Are these tests crucial for rsyslog to work correctly with czmq?

Hi,

The problem is that SO_ERROR is used by ZMQ to check the status of an
asynchronous socket connect() [1].
If that is not available, you would need to write a patch to implement
an alternative method to check for errors, which would probably be a
non-trivial task.

Kind regards,
Luca Boccassi

[1] https://github.com/zeromq/libzmq/blob/master/src/tcp_connecter.cpp line 343
https://github.com/zeromq/libzmq/blob/master/src/socks_connecter.cpp line 395
https://github.com/zeromq/libzmq/blob/master/src/tipc_connecter.cpp line 246
https://github.com/zeromq/libzmq/blob/master/src/ipc_connecter.cpp line 254



Bug#799235: zeromq3: Patch for GNU/Hurd support

2015-10-06 Thread Svante Signell
tags 799235 patch
usertag 799235 hurd
user debian-h...@lists.debian.org
thanks

Source: zeromq3
Version: 4.0.5+dfsg-3
Severity: important
Justification: fails to build from source

Hello,

The attached patch adds support for zeromq3 on GNU/Hurd. Two tests
fails causing ssh to hang and crashes a translator in a hurd terminal:
test_pair_ipc and test_reqrep_ipc. Partial problems with these tests
are that option SO_ERROR is not yet supported for gsetsockopt() on
Hurd.

Investigation is ongoing. This is reflected in tests/Makefile.am which
excludes these tests.

Are these tests crucial for rsyslog to work correctly with czmq?

Thanks!
Index: zeromq3-4.0.5+dfsg/configure.ac
===
--- zeromq3-4.0.5+dfsg.orig/configure.ac
+++ zeromq3-4.0.5+dfsg/configure.ac
@@ -115,6 +115,7 @@ libzmq_dso_visibility="yes"
 libzmq_on_mingw32="no"
 libzmq_on_android="no"
 libzmq_on_linux="no"
+libzmq_on_gnu="no"
 
 # Set some default features required by 0MQ code.
 CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE $CPPFLAGS"
@@ -122,6 +123,20 @@ CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE $C
 # For host type checks
 AC_CANONICAL_HOST
 
+#For a working getsockopt() optname=SO_ERROR
+dnl AC_MSG_CHECKING([for getsockopt optname SO_ERROR)])
+dnl AC_TRY_COMPILE([
+dnl #include 
+dnl #include 
+dnl ], [socklen_t t;], ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no)
+dnl if test "x$ac_cv_type_socklen_t" = "xyes"; then
+dnl AC_MSG_RESULT([yes])
+dnl AC_DEFINE(HAVE_SOCKLEN_T,1,
+dnl   [Define if socklen_t is available])
+dnl   else
+dnl   AC_MSG_RESULT([no])
+dnl   fi
+
 # OS-specific tests
 case "${host_os}" in
 *linux*)
@@ -249,6 +264,17 @@ case "${host_os}" in
 AC_MSG_ERROR([Building static libraries is not supported under Cygwin])
 fi
 ;;
+gnu*)
+# Define on GNU/Hurd to enable all library features. Define if using a gnu compiler
+if test "x$GXX" = "xyes"; then
+CPPFLAGS="-D_GNU_SOURCE $CPPFLAGS"
+fi
+AC_DEFINE(ZMQ_HAVE_GNU, 1, [Have GNU/Hurd OS])
+libzmq_on_gnu="yes"
+	AC_CHECK_LIB(rt, sem_init)
+dnlAC_CHECK_LIB(uuid, uuid_generate, ,
+dnl[AC_MSG_ERROR([cannot link with -luuid, install uuid-dev.])])
+;;
 *)
 AC_MSG_ERROR([unsupported system: ${host_os}.])
 ;;
@@ -431,6 +457,7 @@ AM_CONDITIONAL(BUILD_PGM, test "x$libzmq
 AM_CONDITIONAL(ON_MINGW, test "x$libzmq_on_mingw32" = "xyes")
 AM_CONDITIONAL(ON_ANDROID, test "x$libzmq_on_android" = "xyes")
 AM_CONDITIONAL(ON_LINUX, test "x$libzmq_on_linux" = "xyes")
+AM_CONDITIONAL(ON_GNU, test "x$libzmq_on_gnu" = "xyes")
 
 # Checks for library functions.
 AC_TYPE_SIGNAL
Index: zeromq3-4.0.5+dfsg/src/poller.hpp
===
--- zeromq3-4.0.5+dfsg.orig/src/poller.hpp
+++ zeromq3-4.0.5+dfsg/src/poller.hpp
@@ -73,6 +73,13 @@
 #elif defined ZMQ_HAVE_CYGWIN
 #define ZMQ_USE_SELECT
 #include "select.hpp"
+#elif defined ZMQ_HAVE_GNU
+#define ZMQ_USE_SELECT
+#include "select.hpp"
+#if 0
+#define ZMQ_USE_POLL
+#include "poll.hpp"
+#endif
 #else
 #error Unsupported platform
 #endif
Index: zeromq3-4.0.5+dfsg/tests/Makefile.am
===
--- zeromq3-4.0.5+dfsg.orig/tests/Makefile.am
+++ zeromq3-4.0.5+dfsg/tests/Makefile.am
@@ -43,10 +43,12 @@ noinst_PROGRAMS = test_system \
 
 if !ON_MINGW
 noinst_PROGRAMS += test_shutdown_stress \
-   test_pair_ipc \
-   test_reqrep_ipc \
test_timeo \
test_fork
+if !ON_GNU
+noinst_PROGRAMS += test_pair_ipc \
+   test_reqrep_ipc
+endif
 endif
 
 test_system_SOURCES = test_system.cpp
@@ -100,4 +102,8 @@ TESTS = $(noinst_PROGRAMS)
 
 if !ON_LINUX
 XFAIL_TESTS = test_abstract_ipc
+# Does just hang, no error exit, see above
+#if ON_GNU
+#XFAIL_TESTS += test_pair_ipc test_reqrep_ipc
+#endif
 endif
Index: zeromq3-4.0.5+dfsg/src/ipc_connecter.cpp
===
--- zeromq3-4.0.5+dfsg.orig/src/ipc_connecter.cpp
+++ zeromq3-4.0.5+dfsg/src/ipc_connecter.cpp
@@ -249,10 +249,16 @@ zmq::fd_t zmq::ipc_connecter_t::connect
 //  Assert if the error was caused by 0MQ bug.
 //  Networking problems are OK. No need to assert.
 errno = err;
+#if defined ZMQ_HAVE_GNU
+errno_assert (errno == ECONNREFUSED || errno == ECONNRESET ||
+errno == ETIMEDOUT || errno == EHOSTUNREACH ||
+errno == ENETUNREACH || errno == ENETDOWN ||
+errno == ENOPROTOOPT);
+#else
 errno_assert (errno == ECONNREFUSED || errno == ECONNRESET ||
 errno == ETIMEDOUT || errno == EHOSTUNREACH ||
 errno == ENETUNREACH || errno == ENETDOWN);
-
+#endif
 return retired_fd;
 }
 
Index: zeromq3-4.0.5+dfsg/src/zmq.cpp
===
---