Skip Menu |

This queue is for tickets about the HTTP-Server-Simple CPAN distribution.

Report information
The Basics
Id: 49807
Status: resolved
Priority: 0/
Queue: HTTP-Server-Simple

People
Owner: Nobody in particular
Requestors: ALTREUS [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.40
Fixed in: (no value)



Subject: fails test 04 on FBSD
It tests against 'localhost' but I presume the underlying Mechanize is returning the hostname. I've replaced the hostname it returns with "myhost.com" because it's not my hostname to divulge. Full output: CPAN.pm: Going to build J/JE/JESSE/HTTP-Server-Simple-0.40.tar.gz Checking if your kit is complete... Looks good Writing Makefile for HTTP::Server::Simple cp lib/HTTP/Server/Simple/CGI/Environment.pm blib/lib/HTTP/Server/Simple/CGI/Environment.pm cp lib/HTTP/Server/Simple.pm blib/lib/HTTP/Server/Simple.pm cp lib/HTTP/Server/Simple/CGI.pm blib/lib/HTTP/Server/Simple/CGI.pm Manifying blib/man3/HTTP::Server::Simple::CGI::Environment.3 Manifying blib/man3/HTTP::Server::Simple.3 Manifying blib/man3/HTTP::Server::Simple::CGI.3 JESSE/HTTP-Server-Simple-0.40.tar.gz /usr/bin/make -- OK Running make test PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'inc', 'blib/lib', 'blib/arch')" t/*.t t/00signature.t .... ok t/00smoke.t ........ ok t/01live.t ......... 7/14 # started server PID='18763' t/01live.t ......... ok t/02pod.t .......... ok t/03podcoverage.t .. skipped: Test::Pod::Coverage 1.04 required for testing POD coverage t/04cgi.t .......... 2/22 # Failed test 'method - url' # at t/04cgi.t line 45. # 'HTTP/1.0 200 OK # Content-Type: text/html # Content-Length: 39 # # url: http://myhost.com:45700' # doesn't match '/url: http://localhost:45700/' t/04cgi.t .......... 7/22 # Failed test 'method - server_name' # at t/04cgi.t line 45. # 'HTTP/1.0 200 OK # Content-Type: text/html # Content-Length: 34 # # server_name: myhost.com' # doesn't match '/server_name: localhost/' # Failed test 'Environment - SERVER_NAME' # at t/04cgi.t line 54. # 'HTTP/1.0 200 OK # Content-Type: text/html # Content-Length: 34 # # SERVER_NAME: myhost.com' # doesn't match '/SERVER_NAME: localhost/' # Failed test 'Environment - REMOTE_ADDR' # at t/04cgi.t line 54. # 'HTTP/1.0 200 OK # Content-Type: text/html # Content-Length: 27 # # REMOTE_ADDR: 208.79.212.117' # doesn't match '/REMOTE_ADDR: 127.0.0.1/' t/04cgi.t .......... 17/22 # Failed test 'Environment - SERVER_URL' # at t/04cgi.t line 54. # 'HTTP/1.0 200 OK # Content-Type: text/html # Content-Length: 47 # # SERVER_URL: http://myhost.com:45700/' # doesn't match '/SERVER_URL: http://localhost:45700//' # Looks like you failed 5 tests of 22. t/04cgi.t .......... Dubious, test returned 5 (wstat 1280, 0x500) Failed 5/22 subtests Test Summary Report ------------------- t/04cgi.t (Wstat: 1280 Tests: 22 Failed: 5) Failed tests: 6, 9-11, 18 Non-zero exit status: 5 Files=6, Tests=48, 11 wallclock secs ( 0.18 usr 0.07 sys + 1.71 cusr 0.16 csys = 2.12 CPU) Result: FAIL Failed 1/6 test programs. 5/48 subtests failed. *** Error code 5
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #49807] fails test 04 on FBSD
Date: Tue, 22 Sep 2009 09:10:10 -0400
To: Alastair Douglas via RT <bug-HTTP-Server-Simple [...] rt.cpan.org>
From: jesse <jesse [...] fsck.com>
What does your /etc/hosts file look like? On Fri, Sep 18, 2009 at 06:19:10AM -0400, Alastair Douglas via RT wrote: Show quoted text
> Fri Sep 18 06:19:09 2009: Request 49807 was acted upon. > Transaction: Ticket created by ALTREUS > Queue: HTTP-Server-Simple > Subject: fails test 04 on FBSD > Broken in: 0.40 > Severity: Critical > Owner: Nobody > Requestors: ALTREUS@cpan.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=49807 > > > > It tests against 'localhost' but I presume the underlying Mechanize is > returning the hostname. > > I've replaced the hostname it returns with "myhost.com" because it's not > my hostname to divulge. > > > Full output: > > CPAN.pm: Going to build J/JE/JESSE/HTTP-Server-Simple-0.40.tar.gz > > Checking if your kit is complete... > Looks good > Writing Makefile for HTTP::Server::Simple > cp lib/HTTP/Server/Simple/CGI/Environment.pm > blib/lib/HTTP/Server/Simple/CGI/Environment.pm > cp lib/HTTP/Server/Simple.pm blib/lib/HTTP/Server/Simple.pm > cp lib/HTTP/Server/Simple/CGI.pm blib/lib/HTTP/Server/Simple/CGI.pm > Manifying blib/man3/HTTP::Server::Simple::CGI::Environment.3 > Manifying blib/man3/HTTP::Server::Simple.3 > Manifying blib/man3/HTTP::Server::Simple::CGI.3 > JESSE/HTTP-Server-Simple-0.40.tar.gz > /usr/bin/make -- OK > Running make test > PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM" "-e" > "test_harness(0, 'inc', 'blib/lib', 'blib/arch')" t/*.t > t/00signature.t .... ok > t/00smoke.t ........ ok > t/01live.t ......... 7/14 # started server PID='18763' > t/01live.t ......... ok > t/02pod.t .......... ok > t/03podcoverage.t .. skipped: Test::Pod::Coverage 1.04 required for > testing POD coverage > t/04cgi.t .......... 2/22 > # Failed test 'method - url' > # at t/04cgi.t line 45. > # 'HTTP/1.0 200 OK > # Content-Type: text/html > # Content-Length: 39 > # > # url: http://myhost.com:45700' > # doesn't match '/url: http://localhost:45700/' > t/04cgi.t .......... 7/22 > # Failed test 'method - server_name' > # at t/04cgi.t line 45. > # 'HTTP/1.0 200 OK > # Content-Type: text/html > # Content-Length: 34 > # > # server_name: myhost.com' > # doesn't match '/server_name: localhost/' > > # Failed test 'Environment - SERVER_NAME' > # at t/04cgi.t line 54. > # 'HTTP/1.0 200 OK > # Content-Type: text/html > # Content-Length: 34 > # > # SERVER_NAME: myhost.com' > # doesn't match '/SERVER_NAME: localhost/' > > # Failed test 'Environment - REMOTE_ADDR' > # at t/04cgi.t line 54. > # 'HTTP/1.0 200 OK > # Content-Type: text/html > # Content-Length: 27 > # > # REMOTE_ADDR: 208.79.212.117' > # doesn't match '/REMOTE_ADDR: 127.0.0.1/' > t/04cgi.t .......... 17/22 > # Failed test 'Environment - SERVER_URL' > # at t/04cgi.t line 54. > # 'HTTP/1.0 200 OK > # Content-Type: text/html > # Content-Length: 47 > # > # SERVER_URL: http://myhost.com:45700/' > # doesn't match '/SERVER_URL: http://localhost:45700//' > # Looks like you failed 5 tests of 22. > t/04cgi.t .......... Dubious, test returned 5 (wstat 1280, 0x500) > Failed 5/22 subtests > > Test Summary Report > ------------------- > t/04cgi.t (Wstat: 1280 Tests: 22 Failed: 5) > Failed tests: 6, 9-11, 18 > Non-zero exit status: 5 > Files=6, Tests=48, 11 wallclock secs ( 0.18 usr 0.07 sys + 1.71 cusr > 0.16 csys = 2.12 CPU) > Result: FAIL > Failed 1/6 test programs. 5/48 subtests failed. > *** Error code 5 >
--
On 2009-09-18 11:19:09, ALTREUS wrote: Show quoted text
> It tests against 'localhost' but I presume the underlying Mechanize is > returning the hostname.
I can't reproduce this on a normal FreeBSD host, but I see the same failures when using FreeBSD within a jail. What does "sysctl security.jail.jailed" return from a shell? It seems this is documented behaviour. jail(2) says: All IP activity will be forced to happen to/from the IP number specified, which should be an alias on one of the network interfaces. All connections to/from the loopback address (127.0.0.1 for IPv4, ::1 for IPv6) will be changed to be to/from the primary address of the jail for the given address family. HTTP::Server::Simple works fine on a jailed host, it's just that the tests' usual expectation about hostnames don't apply here. Tom
On Fri Mar 11 09:41:13 2011, TOMHUKINS wrote: Show quoted text
> What does "sysctl security.jail.jailed" return from a shell? >
Cripes, 2009. I don't even think I have an account at wherever this was any more :x I do know that the account I had was a VM; may well have been implemented with jail somewhere along the way. Sorry I can't be of much use, but what you found sounds like a plausible explanation.
RT-Send-CC: jesse [...] fsck.com
On 2011-03-11 14:41:13, TOMHUKINS wrote: Show quoted text
> HTTP::Server::Simple works fine on a jailed host, it's just that the > tests' usual expectation about hostnames don't apply here.
I've attached a patch that solves this problem for me. Tom
Subject: freebsd-jail.patch
diff --git a/t/04cgi.t b/t/04cgi.t index 2c3317f..1b6a5e1 100644 --- a/t/04cgi.t +++ b/t/04cgi.t @@ -2,7 +2,6 @@ use Test::More; use Socket; use strict; -plan tests => 23; my $PORT = 40000 + int(rand(10000)); my $host = gethostbyaddr(inet_aton('localhost'), AF_INET); @@ -30,6 +29,15 @@ my %envvars=( PATH_INFO => 'PATH_INFO: /cgitest/PATH_INFO', ); +if ($^O eq 'freebsd' && `sysctl -n security.jail.jailed` == 1) { + delete @methods{qw(url server_name)}; + delete @envvars{qw(SERVER_URL SERVER_NAME REMOTE_ADDR)}; + plan tests => 18; +} +else { + plan tests => 23; +} + { my $server=CGIServer->new($PORT); is($server->port(),$PORT,'Constructor set port correctly');
Subject: Re: [rt.cpan.org #49807] fails test 04 on FBSD
Date: Mon, 4 Apr 2011 17:04:12 +1000
To: Tom Hukins via RT <bug-HTTP-Server-Simple [...] rt.cpan.org>
From: Jesse Vincent <jesse [...] fsck.com>
Thanks, Applied, Released. On Sun 13.Mar'11 at 17:02:18 -0400, Tom Hukins via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=49807 > > > On 2011-03-11 14:41:13, TOMHUKINS wrote:
> > HTTP::Server::Simple works fine on a jailed host, it's just that the > > tests' usual expectation about hostnames don't apply here.
> > I've attached a patch that solves this problem for me. > > Tom
Show quoted text
> diff --git a/t/04cgi.t b/t/04cgi.t > index 2c3317f..1b6a5e1 100644 > --- a/t/04cgi.t > +++ b/t/04cgi.t > @@ -2,7 +2,6 @@ use Test::More; > use Socket; > use strict; > > -plan tests => 23; > my $PORT = 40000 + int(rand(10000)); > > my $host = gethostbyaddr(inet_aton('localhost'), AF_INET); > @@ -30,6 +29,15 @@ my %envvars=( > PATH_INFO => 'PATH_INFO: /cgitest/PATH_INFO', > ); > > +if ($^O eq 'freebsd' && `sysctl -n security.jail.jailed` == 1) { > + delete @methods{qw(url server_name)}; > + delete @envvars{qw(SERVER_URL SERVER_NAME REMOTE_ADDR)}; > + plan tests => 18; > +} > +else { > + plan tests => 23; > +} > + > { > my $server=CGIServer->new($PORT); > is($server->port(),$PORT,'Constructor set port correctly');