Re: Bug#748903: python-tornado: FTBFS on hurd-i386
On Thu, 2014-05-22 at 22:49 +0200, Guillem Jover wrote:
> Hi!
>
> On Thu, 2014-05-22 at 09:20:59 +0200, Svante Signell wrote:
> > Source: python-tornado
> > Version: 3.2.0-1
> > Severity: important
> > Tags: patch
> > User: debian-hurd@lists.debian.org
> > Usertags: hurd
>
> > Currently python-tornado fails to build from source on GNU/Hurd due to
> > two failed tests: test_unix_socket and test_unix_socket_bad_request.
> > The attached patch fixes these failures by not using the options
> > SO_REUSEADDR for setsockopt in tornado/netutil.py and SO_ERROR for
> > getsockopt in tornado/iostream.py since they are not yet implemented.
...
>
> I've not verified but if sock.setsockopt is mostly a wrapper on top of
> the POSIX function, then it would be way better to check if errno is
> ENOPROTOOPT, and ignore the error condition then. Which would make the
> code not GNU/Hurd specific, would also start testing those flags once
> they are implemented, and might also help any other system where those
> SO_* flags are not implemented yet.
Updated path, renamed to sockopt.patch. Test built on GNU/Hurd and
GNU/Linux. Better now?
Index: python-tornado-3.2.0/tornado/netutil.py
===================================================================
--- python-tornado-3.2.0.orig/tornado/netutil.py
+++ python-tornado-3.2.0/tornado/netutil.py
@@ -119,7 +119,11 @@ if hasattr(socket, 'AF_UNIX'):
"""
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
set_close_exec(sock.fileno())
- sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
+ try:
+ sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
+ except socket.error as e:
+ if e.args[0] != errno.ENOPROTOOPT:
+ raise
sock.setblocking(0)
try:
st = os.stat(file)
Index: python-tornado-3.2.0/tornado/iostream.py
===================================================================
--- python-tornado-3.2.0.orig/tornado/iostream.py
+++ python-tornado-3.2.0/tornado/iostream.py
@@ -748,7 +748,11 @@ class IOStream(BaseIOStream):
self._add_io_state(self.io_loop.WRITE)
def _handle_connect(self):
- err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)
+ try:
+ err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)
+ except socket.error as e:
+ if e.args[0] == errno.ENOPROTOOPT:
+ err = 0
if err != 0:
self.error = socket.error(err, os.strerror(err))
# IOLoop implementations may vary: some of them return
Reply to: