[Python-modules-team] Bug#748903: python-tornado: FTBFS on hurd-i386

Samuel Thibault sthibault at debian.org
Thu May 22 07:48:05 UTC 2014


Svante Signell, le Thu 22 May 2014 09:20:59 +0200, a écrit :
> 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.

Just to avoid a misunderstanding: they *are* implemented, but only for
TCP/IP sockets.

> --- 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)

I would even just drop it completely for all systems: I don't see what
SO_REUSEADDR can mean for an AF_UNIX socket.

> --- 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

I would rather just catch the ENOSYS error, and return None in that
case.  Again, the idea is that I don't see what SO_ERROR could actually
report for AF_UNIX sockets.

> @@ -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:
>              self.error = socket.error(err, os.strerror(err))
>              # IOLoop implementations may vary: some of them return

Same here.

Samuel



More information about the Python-modules-team mailing list