Package: libuv-dev
Version: 0.10.28-3
Severity: normal
Tags: patch
Building on the hppa/parisc arch fails, because libuv fails to run sucessfully
quite some integrated tests as can be seen in this log:
http://buildd.debian-ports.org/status/fetch.php?pkg=libuv&arch=hppa&ver=0.10.28-3&stamp=1409185348
I invested some time to find the reason why it fails, and it turned out that it
happens because there is an
assumption in the libuv linux-syscalls.h header file, that on all Linux
platforms the value of O_NONBLOCK is the same as SOCK_NONBLOCK.
That's at least not true for hppa.
In src/unix/linux-syscalls.h we have for hppa:
# define UV__O_NONBLOCK 0x10004 (hppa)
and later down:
#define UV__SOCK_NONBLOCK UV__O_NONBLOCK
This means, libuv uses even for socket syscalls UV__O_NONBLOCK instead of the
value of SOCK_NONBLOCK.
So, when the tests run, the kernel will correctly return -EINVAL on most socket
syscalls and thus the libuv testcases fail.
The attached trivial patch fixes this problem on the hppa platform and it
should be safe to use it for all other platforms too.
It would be great if you could apply it to the next upload of libuv.
Thanks,
Helge
diff -up ./src/unix/linux-syscalls.h.org ./src/unix/linux-syscalls.h
--- ./src/unix/linux-syscalls.h.org 2014-08-29 11:07:57.439621858 +0200
+++ ./src/unix/linux-syscalls.h 2014-08-29 11:22:24.050133474 +0200
@@ -43,7 +43,7 @@
#if defined(__alpha__)
# define UV__O_NONBLOCK 0x4
#elif defined(__hppa__)
-# define UV__O_NONBLOCK 0x10004
+# define UV__O_NONBLOCK O_NONBLOCK
#elif defined(__mips__)
# define UV__O_NONBLOCK 0x80
#elif defined(__sparc__)
@@ -59,7 +59,11 @@
#define UV__IN_NONBLOCK UV__O_NONBLOCK
#define UV__SOCK_CLOEXEC UV__O_CLOEXEC
-#define UV__SOCK_NONBLOCK UV__O_NONBLOCK
+#if defined(SOCK_NONBLOCK)
+# define UV__SOCK_NONBLOCK SOCK_NONBLOCK
+#else
+# define UV__SOCK_NONBLOCK UV__O_NONBLOCK
+#endif
/* epoll flags */
#define UV__EPOLL_CLOEXEC UV__O_CLOEXEC