From: Nicholas Clark Date: Sat, 9 Dec 2000 18:57:25 +0000 (+0000) Subject: [ID 20001209.006] Not OK: perl v5.7.0 +DEVEL7978 on armv4l-linux-64int 2.2.17-rmk1... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c9491a7625c535c4804b004ee3d75bf0a27cc34b;p=p5sagit%2Fp5-mst-13.2.git [ID 20001209.006] Not OK: perl v5.7.0 +DEVEL7978 on armv4l-linux-64int 2.2.17-rmk1 (UNINSTALLED) Message-Id: Be more robust in weird hostname setups. p4raw-id: //depot/perl@8062 --- diff --git a/t/lib/net-hostent.t b/t/lib/net-hostent.t index b1c7a9d..abc5b92 100644 --- a/t/lib/net-hostent.t +++ b/t/lib/net-hostent.t @@ -44,9 +44,29 @@ print "ok 5\n"; if ($^O eq 'MSWin32' or $^O eq 'cygwin') { print "ok $_ # skipped on win32\n" for (6,7); } else { - print "not " unless $h->name =~ /^localhost(?:\..+)?$/i; - print "ok 6 # ",$h->name,"\n"; + my $in_alias; + unless ($h->name =~ /^localhost(?:\..+)?$/i) { + foreach (@{$h->aliases}) { + if (/^localhost(?:\..+)?$/i) { + $in_alias = 1; + last; + } + } + print "not " unless $in_alias; + } # Else we found it as the hostname + print "ok 6 # ",$h->name, " ", join (",", @{$h->aliases}), "\n"; - print "not " unless $i->name =~ /^localhost(?:\..+)?$/i; - print "ok 7 # ",$i->name,"\n"; + if ($in_alias) { + # If we found it in the aliases before, expect to find it there again. + foreach (@{$h->aliases}) { + if (/^localhost(?:\..+)?$/i) { + undef $in_alias; # This time, clear the flag if we see "localhost" + last; + } + } + print "not " if $in_alias; + } else { + print "not " unless $i->name =~ /^localhost(?:\..+)?$/i; + } + print "ok 7 # ",$h->name, " ", join (",", @{$h->aliases}), "\n"; }