bug in test lib in mod_perl 2.0.8 / apache 2.2.27 - w/ patch

Mark Hedges <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <55EEF0B3C5BF2744B2248754D717EE4C4B0613@USASHEXMB02.LYV.LiveNation.com>
This appears to be a bug in a test library in the released current version mod_perl 2.0.8.  $r->args can return undef if there is no ? in the url to specify a query string, apparently.  Patch is at the bottom.  HTH.  -Mark

[email protected] /ntfhome/local/src/perl/mod_perl-2.0.8
2014-06-22 23:01:22 Sun  $ t/TEST -verbose t/api/err_headers_out.t t/directive/perlloadmodule2.t 
/ntfhome/local/sbin/httpd  -d /ntfhome/local/src/perl/mod_perl-2.0.8/t -f /ntfhome/local/src/perl/mod_perl-2.0.8/t/conf/httpd.conf -D APACHE2 -D PERL_USEITHREADS
using Apache/2.2.27 (prefork MPM)

waiting 120 seconds for server to start: .[Sun Jun 22 23:01:46 2014] [info] 6 Apache2:: modules loaded
[Sun Jun 22 23:01:46 2014] [info] 0 APR:: modules loaded
[Sun Jun 22 23:01:46 2014] [info] base server + 29 vhosts ready to run tests
....
waiting 120 seconds for server to start: ok (waited 3 secs)
server localhost:8529 started
server localhost:8530 listening (filter_out_apache)
server localhost:8531 listening (perlsections)
server localhost:8532 listening (inherit)
server localhost:8533 listening (TestModperl::merge)
server localhost:8534 listening (TestModperl::perl_options)
server localhost:8535 listening (TestModperl::perl_options2)
server localhost:8536 listening (TestModperl::setupenv)
server localhost:8537 listening (TestModules::proxy)
server localhost:8538 listening (TestUser::rewrite)
server localhost:8539 listening (TestVhost::config)
server localhost:8540 listening (TestVhost::log)
server localhost:8541 listening (TestProtocol::echo_bbs)
server localhost:8542 listening (TestProtocol::echo_bbs2)
server localhost:8543 listening (TestProtocol::echo_block)
server localhost:8544 listening (TestProtocol::echo_filter)
server localhost:8545 listening (TestProtocol::echo_nonblock)
server localhost:8546 listening (TestProtocol::echo_timeout)
server localhost:8547 listening (TestProtocol::pseudo_http)
server localhost:8548 listening (TestPreConnection::note)
server localhost:8549 listening (TestHooks::hookrun)
server localhost:8550 listening (TestHooks::init)
server localhost:8551 listening (TestHooks::stacked_handlers2)
server localhost:8552 listening (TestHooks::startup)
server localhost:8553 listening (TestHooks::trans)
server localhost:8554 listening (TestFilter::both_str_con_add)
server localhost:8555 listening (TestFilter::in_bbs_inject_header)
server localhost:8556 listening (TestFilter::in_bbs_msg)
server localhost:8557 listening (TestFilter::in_str_msg)
server localhost:8558 listening (TestDirective::perlmodule)
server localhost:8559 listening (TestDirective::perlrequire)
server localhost:8560 listening (TestAPI::add_config)
server localhost:8561 listening (TestDirective::perlloadmodule3)
server localhost:8562 listening (TestDirective::perlloadmodule4)
server localhost:8563 listening (TestDirective::perlloadmodule5)
server localhost:8564 listening (TestDirective::perlloadmodule6)
server localhost:8565 listening (TestHooks::push_handlers_anon)
t/api/err_headers_out.t ........ 
1..6
# Running under perl version 5.020000 for linux
# Current time local: Sun Jun 22 23:01:51 2014
# Current time GMT:   Mon Jun 23 06:01:51 2014
# Using Test.pm version 1.26
# Using Apache/Test.pm version 1.37
# testing : OK
# expected: 200
# received: 200
ok 1
# testing : X-err_headers_out: made it
# expected: err_headers_out
# received: undef
not ok 2
# Failed test 2 in t/api/err_headers_out.t at line 30
# testing : X-headers_out: made it
# expected: headers_out
# received: undef
not ok 3
# Failed test 3 in t/api/err_headers_out.t at line 33
# testing : not found
# expected: 404
# received: 404
ok 4
# testing : X-err_headers_out: made it
# expected: err_headers_out
# received: undef
not ok 5
# Failed test 5 in t/api/err_headers_out.t at line 55
ok 6
Failed 3/6 subtests 
t/directive/perlloadmodule2.t .. 
1..3
# Running under perl version 5.020000 for linux
# Current time local: Sun Jun 22 23:01:52 2014
# Current time GMT:   Mon Jun 23 06:01:52 2014
# Using Test.pm version 1.26
# Using Apache/Test.pm version 1.37
# testing : access server settings
# expected: srv: one two
# received: srv: one two
ok 1
# testing : server/dir merge
# expected: dir: one two three four
# received: dir: one two three four
ok 2
# testing : server/dir/subdir merge
# expected: dir: one two three four five six
# received: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
# <html><head>
# <title>500 Internal Server Error</title>
# </head><body>
# <h1>Internal Server Error</h1>
# <p>The server encountered an internal error or
# misconfiguration and was unable to complete
# your request.</p>
# <p>Please contact the server administrator,
#  [email protected] and inform them of the time the error occurred,
# and anything you might have done that may have
# caused the error.</p>
# <p>More information about this error may be available
# in the server error log.</p>
# <hr>
# <address>Apache/2.2.27 (Unix) world domination series/2.0 mod_perl/2.0.8 Perl/v5.20.0 Server at localhost Port 8529</address>
# </body></html>
not ok 3
# Failed test 3 in t/directive/perlloadmodule2.t at line 30
Failed 1/3 subtests 

Test Summary Report
-------------------
t/api/err_headers_out.t      (Wstat: 0 Tests: 6 Failed: 3)
  Failed tests:  2-3, 5
t/directive/perlloadmodule2.t (Wstat: 0 Tests: 3 Failed: 1)
  Failed test:  3
Files=2, Tests=9,  3 wallclock secs ( 0.06 usr  0.06 sys +  1.48 cusr  0.45 csys =  2.05 CPU)
Result: FAIL
Failed 2/2 test programs. 4/9 subtests failed.
[warning] server localhost:8529 shutdown
[warning] port 8529 still in use...
done
[  error] error running tests (please examine t/logs/error_log)
                                               
[email protected] /ntfhome/local/src/perl/mod_perl-2.0.8
2014-06-22 23:01:57 Sun  $ cat t/logs/error_log 
********************************************************************************
*** This is a test for Apache2::ServerUtil::server_shutdown_cleanup_register ***
*** Following a line consisting only of * characters there should be a line  ***
*** containing                                                               ***
***     "cleanup died: testing server_shutdown_cleanup_register".            ***
*** The next line should then read                                           ***
***     "done with server_shutdown_cleanup_register"                         ***
********************************************************************************
Apache2::ServerUtil: cleanup died: testing server_shutdown_cleanup_register
*** done with server_shutdown_cleanup_register                               ***
********************************************************************************
END in modperl_extra.pl, pid=21358
[Sun Jun 22 23:01:50 2014] [notice] Digest: generating secret for digest authentication ...
[Sun Jun 22 23:01:50 2014] [notice] Digest: done
[Sun Jun 22 23:01:50 2014] [notice] Apache/2.2.27 (Unix) world domination series/2.0 mod_perl/2.0.8 Perl/v5.20.0 configured -- resuming normal operations
[Sun Jun 22 23:01:50 2014] [info] Server built: Jun 22 2014 14:00:48
[Sun Jun 22 23:01:50 2014] [debug] prefork.c(1023): AcceptMutex: sysvsem (default: sysvsem)
[Sun Jun 22 23:01:53 2014] [error] [client 127.0.0.1] Use of uninitialized value in string eq at /ntfhome/local/src/perl/mod_perl-2.0.8/t/response/TestDirective/perlloadmodule2.pm line 85.\n
[Sun Jun 22 23:01:54 2014] [info] Child process pid=21367 is exiting
[Sun Jun 22 23:01:54 2014] [info] Child process pid=21366 is exiting
[Sun Jun 22 23:01:54 2014] [info] Child process pid=21367 is exiting - server push
[Sun Jun 22 23:01:54 2014] [info] Child process pid=21366 is exiting - server push
END in modperl_extra.pl, pid=21367
END in modperl_extra.pl, pid=21366
[Sun Jun 22 23:01:55 2014] [info] removed PID file /ntfhome/local/src/perl/mod_perl-2.0.8/t/logs/httpd.pid (pid=21362)
[Sun Jun 22 23:01:55 2014] [notice] caught SIGTERM, shutting down
********************************************************************************
*** This is a test for Apache2::ServerUtil::server_shutdown_cleanup_register ***
*** Following a line consisting only of * characters there should be a line  ***
*** containing                                                               ***
***     "cleanup died: testing server_shutdown_cleanup_register".            ***
*** The next line should then read                                           ***
***     "done with server_shutdown_cleanup_register"                         ***
********************************************************************************
Apache2::ServerUtil: cleanup died: testing server_shutdown_cleanup_register
*** done with server_shutdown_cleanup_register                               ***
********************************************************************************
END in modperl_extra.pl, pid=21362
                                               
[email protected] /ntfhome/local/src/perl/mod_perl-2.0.8
2014-06-22 23:07:19 Sun  $ cp /ntfhome/local/src/perl/mod_perl-2.0.8/t/response/TestDirective/perlloadmodule2.pm /ntfhome/local/src/perl/mod_perl-2.0.8/t/response/TestDirective/perlloadmodule2.pm.orig
                                               
[email protected] /ntfhome/local/src/perl/mod_perl-2.0.8
2014-06-22 23:07:40 Sun  $ gvim /ntfhome/local/src/perl/mod_perl-2.0.8/t/response/TestDirective/perlloadmodule2.pm
                                               
[email protected] /ntfhome/local/src/perl/mod_perl-2.0.8
2014-06-22 23:07:46 Sun  $ t/TEST -verbose t/directive/perlloadmodule2.t 
/ntfhome/local/sbin/httpd  -d /ntfhome/local/src/perl/mod_perl-2.0.8/t -f /ntfhome/local/src/perl/mod_perl-2.0.8/t/conf/httpd.conf -D APACHE2 -D PERL_USEITHREADS
using Apache/2.2.27 (prefork MPM)

waiting 120 seconds for server to start: .[Sun Jun 22 23:08:51 2014] [info] 6 Apache2:: modules loaded
[Sun Jun 22 23:08:51 2014] [info] 0 APR:: modules loaded
[Sun Jun 22 23:08:51 2014] [info] base server + 29 vhosts ready to run tests
....
waiting 120 seconds for server to start: ok (waited 4 secs)
server localhost:8529 started
server localhost:8530 listening (filter_out_apache)
server localhost:8531 listening (perlsections)
server localhost:8532 listening (inherit)
server localhost:8533 listening (TestModperl::merge)
server localhost:8534 listening (TestModperl::perl_options)
server localhost:8535 listening (TestModperl::perl_options2)
server localhost:8536 listening (TestModperl::setupenv)
server localhost:8537 listening (TestModules::proxy)
server localhost:8538 listening (TestUser::rewrite)
server localhost:8539 listening (TestVhost::config)
server localhost:8540 listening (TestVhost::log)
server localhost:8541 listening (TestProtocol::echo_bbs)
server localhost:8542 listening (TestProtocol::echo_bbs2)
server localhost:8543 listening (TestProtocol::echo_block)
server localhost:8544 listening (TestProtocol::echo_filter)
server localhost:8545 listening (TestProtocol::echo_nonblock)
server localhost:8546 listening (TestProtocol::echo_timeout)
server localhost:8547 listening (TestProtocol::pseudo_http)
server localhost:8548 listening (TestPreConnection::note)
server localhost:8549 listening (TestHooks::hookrun)
server localhost:8550 listening (TestHooks::init)
server localhost:8551 listening (TestHooks::stacked_handlers2)
server localhost:8552 listening (TestHooks::startup)
server localhost:8553 listening (TestHooks::trans)
server localhost:8554 listening (TestFilter::both_str_con_add)
server localhost:8555 listening (TestFilter::in_bbs_inject_header)
server localhost:8556 listening (TestFilter::in_bbs_msg)
server localhost:8557 listening (TestFilter::in_str_msg)
server localhost:8558 listening (TestDirective::perlmodule)
server localhost:8559 listening (TestDirective::perlrequire)
server localhost:8560 listening (TestAPI::add_config)
server localhost:8561 listening (TestDirective::perlloadmodule3)
server localhost:8562 listening (TestDirective::perlloadmodule4)
server localhost:8563 listening (TestDirective::perlloadmodule5)
server localhost:8564 listening (TestDirective::perlloadmodule6)
server localhost:8565 listening (TestHooks::push_handlers_anon)
t/directive/perlloadmodule2.t .. 
1..3
# Running under perl version 5.020000 for linux
# Current time local: Sun Jun 22 23:08:56 2014
# Current time GMT:   Mon Jun 23 06:08:56 2014
# Using Test.pm version 1.26
# Using Apache/Test.pm version 1.37
# testing : access server settings
# expected: srv: one two
# received: srv: one two
ok 1
# testing : server/dir merge
# expected: dir: one two three four
# received: dir: one two three four
ok 2
# testing : server/dir/subdir merge
# expected: dir: one two three four five six
# received: dir: one two three four five six
ok 3
ok
All tests successful.
Files=1, Tests=3,  1 wallclock secs ( 0.02 usr  0.01 sys +  0.83 cusr  0.23 csys =  1.09 CPU)
Result: PASS
[warning] server localhost:8529 shutdown
[warning] port 8529 still in use...
done
                                               
[email protected] /ntfhome/local/src/perl/mod_perl-2.0.8
2014-06-22 23:09:00 Sun  $ diff -u /ntfhome/local/src/perl/mod_perl-2.0.8/t/response/TestDirective/perlloadmodule2.pm.orig /ntfhome/local/src/perl/mod_perl-2.0.8/t/response/TestDirective/perlloadmodule2.pm
--- /ntfhome/local/src/perl/mod_perl-2.0.8/t/response/TestDirective/perlloadmodule2.pm.orig	2014-06-22 23:07:40.833878000 -0700
+++ /ntfhome/local/src/perl/mod_perl-2.0.8/t/response/TestDirective/perlloadmodule2.pm	2014-06-22 23:08:16.291719000 -0700
@@ -82,7 +82,8 @@
 
     my $s = $r->server;
 
-    if ($r->args eq 'srv') {
+    my $args = $r->args;
+    if (defined $args && $args eq 'srv') {
         my $srv_cfg = $self->get_config($s);
         $r->print("srv: @{ $srv_cfg->{MyMergeTest}||[] }");
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.