Skip to content
Tcl Source Code View Ticket
Login

View Ticket

"localhost" resolution regression

Closed / Fixed3385024fffffffffffffffffffffffffffffffffCreated 15 years agoUpdated 15 years ago
Descriptionplain2011-08-02 20:02:25
Lo priority matter, but if you try to run the test
suite on a system with no real networking functioning.
several tests fail and test files error out, notably
the http*.test, socket.test, unixInit.test and
zlib.test files.

The error message encountered is:
"host is unreachable (Name or service not known)"

This might really be a system problem, or it might
be an environment which the test suite ought to
tolerate with some constraint usage.
ferrieuxplain2011-08-03 05:23:09
Could is just be the absence of 'localhost' resolution ? (I'm saying this because it appears many times in those files, and I have seen localhost-less machines in real life, despite a fully working loopback interface).
If that's so, using 127.0.0.1 in its stead could help (easy check if you have access to one of those machines).
dgpplain2011-08-03 20:35:25
The problem does appear to be resolution
of the "localhost" name, yes.  I know that
used to work on this system.  I suspect a
regressions related to IPv6 support addition.

I suspect this may have common cause
with 3382419 and 3382431 which appear
on a system that actually still matters.
dgpplain2011-08-03 21:23:08
I happen to have the Tcl 8.5.0 sources
on the same system, and they resolve "localhost"
just fine.
dgp Ticket [3385024fff]: 1 change [History diff]2011-08-03 21:23:23
ferrieuxplain2011-08-03 22:33:37
Two questions:
(1) why not just use 127.0.0.1 throughout the test suite ?
(2) what does your /etc/hosts look like regarding localhost/localhost6 entries ?
dgpplain2011-08-03 23:17:18
I mostly like to have tests that resemble code.
I expect many more programmers will naturally
use "localhost" when they mean that, rather than
127.0.0.1.

My /etc/hosts file on the test system has the line:

127.0.0.1          localhost.localdomain localhost

Test system is also not connected to any network.
dgpplain2011-08-04 00:48:37
If I disable the setting of the AI_ADDRCONFIG flag
in hints.ai_flags, then things work again.  Whatever
is missing on OpenBSD, NetBSD as reported in the
comment is also missing in my test system.  Solution
is apparently some improved autogoo and conditional
coding directives.
dgp Ticket [3385024fff]: 1 change [History diff]2011-08-04 00:49:51
dgpplain2011-08-04 00:51:12
judging by the #if line, things
are also missing on AIX and HPUX systems.
ferrieuxplain2011-08-04 17:13:16
What OS is your test system ?
Also, what does the getaddrinfo manpage say regarding the AI_ADDRCONFIG semantics ?
On linux it says:

       If hints.ai_flags includes the AI_ADDRCONFIG flag, then IPv4 addresses are returned in the list pointed to by result only if the local system has at least one IPv4 address configured,  and  IPv6  addresses
       are only returned if the local system has at least one IPv6 address configured.
dgpplain2011-08-04 20:07:54
This is an alpha PC with Red Hat Linux 6.2 (Zoot)
running on it, dating from around 2000.  The
foundation is version 2.2.23 of the Linux kernel.

Near as I can tell it has no getaddrinfo man page on it.

Comments in the system header file agree with the
man page quote you report on what the purpose
of the AI_ADDRCONFIG flag is.

My aim is not to make this system work; it is retired.
My aim is to use testing on this system to find and fix
any weaknesses in Tcl such testing may expose that
will benefit it on actual systems in use.
rmaxplain2011-08-04 20:37:38
allow_comments - 1

I've commented out the use of AI_ADDRINFO for now.
Let's see if that causes any problems in b3.
dgpplain2011-08-05 03:07:45
Back on my desktop system, the change
causes problems, at least is the test suite
is any measure:

==== socket_any-2.9 socket conflict FAILED
==== Contents of test case:

    set s [socket -server accept 0]
    file delete $path(script)
    set f [open $path(script) w]
    puts $f [list set ::tcl::unsupported::socketAF $::tcl::unsupported::socketAF]
    puts $f "socket -server accept [lindex [fconfigure $s -sockname] 2]"
    close $f
    set f [open "|[list [interpreter] $path(script)]" r]
    gets $f
    after 100
    close $f

---- Result was:
couldn't open socket: address family not supported by protocol
    while executing
"socket -server accept 56387"
    (file "/local/tmp/dgp/fossil/tcl-only/unix/script" line 2)
---- Result should have been (glob matching):
couldn't open socket: address already in use*
==== socket_any-2.9 FAILED
Log in (anonymous is fine) to add a comment.