Subject: | Test 10 in t/getnameinfo.t fails on Solaris 11 due to /etc/hosts format |
This is a bug report for Socket version 2.001, as distributed with
perl-5.16.0-RC2.
Test 10 in cpan/Socket/t/getnameinfo.t test is failing for Solaris
11/x86 (both on my system and in the smoke reports.) I think the test
is probably in error. Here's what's happening: My hostname is "HSC030".
$ uname -a
SunOS HSC030 5.11 snv_151a i86pc i386 i86pc
The default Solaris 11 install puts the following lines in /etc/hosts:
$ grep -v '^#' /etc/hosts
::1 HSC030 HSC030.local localhost loghost
127.0.0.1 HSC030 HSC030.local localhost loghost
Here's what happens:
$ ./perl -MTestInit cpan/Socket/t/getnameinfo.t
1..14
ok 1 - $err == 0 for
{family=AF_INET,port=80,sinaddr=127.0.0.1}/NI_NUMERICHOST|NI_NUMERICSERV
ok 2 - $err eq "" for
{family=AF_INET,port=80,sinaddr=127.0.0.1}/NI_NUMERICHOST|NI_NUMERICSERV
ok 3 - $host is 127.0.0.1 for NH/NS
ok 4 - $service is 80 for NH/NS
ok 5 - $host is undef for NIx_NOHOST
ok 6 - $service is 80 for NS, NIx_NOHOST
ok 7 - $host is undef for NIx_NOSERV
ok 8 - $service is 80 for NS, NIx_NOSERV
ok 9 - $err == 0 for
{family=AF_INET,port=80,sinaddr=127.0.0.1}/NI_NUMERICSERV
not ok 10 - $host is localhost for NS
# Failed test '$host is localhost for NS'
# at cpan/Socket/t/getnameinfo.t line 31.
# got: 'HSC030'
# expected: 'localhost'
ok 11 - $service is 80 for NS
ok 12 - $err == 0 for
{family=AF_INET,port=80,sinaddr=127.0.0.1}/NI_NUMERICHOST
ok 13 - $host is 127.0.0.1 for NH
ok 14 - $service is 80 for NH
# Looks like you failed 1 test of 14.
However, if I change the last line in /etc/hosts to just
127.0.0.1 localhost
then the test passes.
Hence I think the getnameinfo function is working, but the /etc/hosts
file doesn't have the exact same structure as the test is expecting.
I don't know if the Solaris /etc/hosts file is strictly correct or not,
but it is what you get with a default install, so I don't think the
test suite ought to complain about it.
(This failure is not new -- it's present in perl-5.14.2 -- but I just
got around to verifying that the /etc/hosts file is indeed as it was
originally set up by Solaris, and the failure isn't due to my mucking
around with /etc/hosts in some incorrect or misguided way.)