cURL / Mailing Lists / curl-users / Single Mail

curl-users

bugs: runtests.pl can fail to detect that its test port is in use

From: spage <spage_at_macromedia.com>
Date: Thu, 19 Feb 2004 13:38:21 -0800

I'm installing curl-7.11.0 on Solaris 5.6.

When I run `make test`, it prints "System characteristics", then
displays
    binding stream socket: Address already in use
and hangs.

It turns out port 8999 is indeed already in use on our Solaris machine,
by some process that is NOT a plain HTTP server. But tests/runtests.pl
has some bugs such that it does not detect this, and goes on to run
tests against that port.

runtests.pl has a routine runhttpserver() that does:
   # verify if our/any server is running on this port
To do this it runs the command
   ../src/curl -o log/verifiedserver --silent -i
127.0.0.1:8999/verifiedserver 2>/dev/null

On our machine this returns 0x3400 (exit value 52)

If I run
   ../src/curl 127.0.0.1:8999/verifiedserver
by hand, curl prints
   curl: (52) Empty reply from server

So curl's 52 error code indicates there's something on the port. This
is a different curl error code than when nothing's listening on the
port, which I think is "curl: (7) Failed to connect to 127.0.0.1"

bug 1: runtests.pl doesn't analyze this return code for curl errors
like 52.

Instead it goes on to open log/verifiedserver:

333: open(FILE, "<log/verifiedserver");
334: my @file=<FILE>;
335: close(FILE);
336: $data=$file[0]; # first line
337
338: if ( $data =~ /WE ROOLZ: (\d+)/ ) {
339: $pid = 0+$1;
340 }
341 elsif($data) {
342: print "RUN: Unknown HTTP server is running on port
$HOSTPORT\n";
343: return -2;
344 }

bug 2: In my case log/verifiedserver doesn't exist. But runtests.pl
doesn't check for errors from open() , which sets $! to "No such file
or directory" in my case.

bug 3: runtests.pl looks at the first line of output from the curl
request, and only if it evaluates to "true" does it assume an Unknown
HTTP server is running. So if the service on port 8999 returns
something but its first line is 0, runtests.pl will think no server is
running on the port. Unlikely, but could happen. I think it should
check if anything's in @file.

bug 4: It may not be an "HTTP server" running on 8999, it would be more
correct to print the diagnostic "Unknown service already listening on
port $HOSTPORT\n".

(I haven't been able to find out what's running on port 8999, this box
has a thousand uses :-)

Hope you find this useful. Let me know if there's a bug reporting form
for curl I should be using instead.

--
=S Page
Received on 2004-02-19