[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#748903: python-tornado: FTBFS on hurd-i386



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.

> --- a/tornado_netutil.py	2014-01-09 03:57:56.000000000 +0100
> +++ b/tornado/netutil.py	2014-05-21 17:38:42.000000000 +0200
> @@ -119,7 +120,8 @@
>          """
>          sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
>          set_close_exec(sock.fileno())
> -        sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
> +        if sys.platform != 'gnu0':
> +            sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
>          sock.setblocking(0)

> --- a/tornado/iostream.py	2014-01-04 17:51:39.000000000 +0100
> +++ b/tornado/iostream.py	2014-05-21 18:42:37.000000000 +0200
> @@ -687,9 +687,12 @@
>          self.socket = None
>  
>      def get_fd_error(self):
> -        errno = self.socket.getsockopt(socket.SOL_SOCKET,
> -                                       socket.SO_ERROR)
> -        return socket.error(errno, os.strerror(errno))
> +        if sys.platform != 'gnu0':
> +            errno = self.socket.getsockopt(socket.SOL_SOCKET,
> +                                           socket.SO_ERROR)
> +            return socket.error(errno, os.strerror(errno))
> +        else:
> +            return None
>  
>      def read_from_fd(self):
>          try:
> @@ -748,7 +751,10 @@
>          self._add_io_state(self.io_loop.WRITE)
>  
>      def _handle_connect(self):
> -        err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)
> +        if sys.platform != 'gnu0':
> +            err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)
> +        else:
> +            err = 0
>          if err != 0:

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.

Thanks,
Guillem


Reply to: