Bug#962318: libmojolicious-perl: build fails on IPv6-only buildds

Niko Tyni ntyni at debian.org
Mon Jun 8 08:18:09 BST 2020


On Sat, Jun 06, 2020 at 10:22:58AM +0300, Adrian Bunk wrote:
> Source: libmojolicious-perl
> Version: 8.52+dfsg-1
> Severity: serious
> Tags: ftbfs
> 
> https://buildd.debian.org/status/logs.php?pkg=libmojolicious-perl&ver=8.52%2Bdfsg-1
> 
> ...
> Can't create listen socket: Address family for hostname not supported at /<<PKGBUILDDIR>>/blib/lib/Mojo/IOLoop.pm line 123.
> # Tests were run but no plan was declared and done_testing() was not seen.
> ...
> Failed 39/103 test programs. 0/6415 subtests failed.
> make[2]: *** [Makefile:1393: test_dynamic] Error 22
> 
> 
> See #962019 as example of a similar problem in another package.

This seems to be a wider issue. Copying the debian-perl list for
discussion.

The root cause is that IO::Socket::IP defaults to passing AI_ADDRCONFIG
to getaddrinfo(3) if no flags are explicitly specified. From the
getaddrinfo(3) man page:

       If hints.ai_flags includes the AI_ADDRCONFIG flag, then IPv4
       addresses are returned in the list pointed to by res only if
       the local system has at least one IPv4 address configured, and
       IPv6 addresses are returned only if the local system has at
       least one IPv6 address configured.  The loopback address is  not
       considered  for  this  case  as  valid  as  a configured address.
       This flag is useful on, for example, IPv4-only systems, to ensure
       that getaddrinfo() does not return IPv6 socket addresses that
       would always fail in connect(2) or bind(2).

While this may be useful on IPv4-only systems, it breaks on systems with
an IPv6-only network connection that still provide IPv4 on localhost. This
appears to match the recent new official buildds where these failures
happen.

  # perl -MIO::Socket::IP -e 'IO::Socket::IP->new(PeerHost => "127.0.0.1", PeerService => 80) or die'
  Address family for hostname not supported       ...propagated at -e line 1.
  # perl -MIO::Socket::IP -e 'IO::Socket::IP->new(PeerHost => "0.0.0.0", PeerService => 80) or die'
  Address family for hostname not supported       ...propagated at -e line 1.

This breaks various test suites, but also runtime code because of things
like this (from Mojo::IOLoop::Server):

  sub generate_port { IO::Socket::IP->new(Listen => 5, LocalAddr => '127.0.0.1')->sockport }

I tested building a set of 60 packages matching IO::Socket:::IP (according
to codesearch.debian.net) on an IPv6-only system, and found these failures:

h2o
libaudio-mpd-perl
libcrypt-ssleay-perl
libgearman-client-perl
libio-socket-ssl-perl
libmojolicious-perl
libmonitoring-livestatus-perl
libnet-http-perl
libnet-https-nb-perl
libnet-ldap-server-test-perl
libnet-sip-perl
libplack-perl
librpc-xml-perl
libtest-tcp-perl
spamassassin

I suspect there are quite a bit more: for instance, 36 packages build
depend on libtest-tcp-perl, and at least its Net::EmptyPort seems to
suffer from these issues.

I'm left wondering if the IO::Socket::IP default behaviour is desirable,
or whether we should try to change it (maybe to special case localhost
and/or 0.0.0.0 ?)

BTW, I noticed nodejs also fails (with test code listening on 127.0.0.1
but client connecting to ::1) so at least we're not quite alone in this...
-- 
Niko Tyni   ntyni at debian.org



More information about the pkg-perl-maintainers mailing list