You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by st...@apache.org on 2003/03/25 05:49:06 UTC
cvs commit: modperl-2.0/t/conf modperl_extra.pl
stas 2003/03/24 20:49:06
Modified: . Changes
src/modules/perl mod_perl.c
t/conf modperl_extra.pl
Added: t/apache add_config.t
Log:
fix a segfault caused by PerlModule in $s->add_config, due to setting
the MP_init_done flag before init was done + add test
Revision Changes Path
1.157 +3 -0 modperl-2.0/Changes
Index: Changes
===================================================================
RCS file: /home/cvs/modperl-2.0/Changes,v
retrieving revision 1.156
retrieving revision 1.157
diff -u -r1.156 -r1.157
--- Changes 24 Mar 2003 03:00:19 -0000 1.156
+++ Changes 25 Mar 2003 04:49:05 -0000 1.157
@@ -10,6 +10,9 @@
=item 1.99_09-dev
+fix a segfault caused by PerlModule in $s->add_config, due to setting
+the MP_init_done flag before init was done + add test [Stas]
+
adjust the generated Makefile's to properly build on aix (tested on
powerpc-ibm-aix5.1.0.0) [Stas]
1.158 +5 -3 modperl-2.0/src/modules/perl/mod_perl.c
Index: mod_perl.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.c,v
retrieving revision 1.157
retrieving revision 1.158
diff -u -r1.157 -r1.158
--- mod_perl.c 17 Mar 2003 02:15:09 -0000 1.157
+++ mod_perl.c 25 Mar 2003 04:49:05 -0000 1.158
@@ -306,6 +306,8 @@
return OK;
}
+static int MP_init_done = 0;
+
void modperl_init(server_rec *base_server, apr_pool_t *p)
{
server_rec *s;
@@ -346,6 +348,8 @@
base_perl = modperl_startup(base_server, p);
+ MP_init_done++;
+
#ifdef USE_ITHREADS
modperl_interp_init(base_server, p, base_perl);
MpInterpBASE_On(base_scfg->mip->parent);
@@ -446,8 +450,6 @@
return APR_SUCCESS;
}
-static int MP_init_done = 0;
-
static apr_status_t modperl_sys_term(void *data)
{
MP_init_done = 0;
@@ -465,7 +467,7 @@
int modperl_hook_init(apr_pool_t *pconf, apr_pool_t *plog,
apr_pool_t *ptemp, server_rec *s)
{
- if (MP_init_done++ > 0) {
+ if (MP_init_done > 0) {
return OK;
}
1.1 modperl-2.0/t/apache/add_config.t
Index: add_config.t
===================================================================
# the handler is configured in modperl_extra.pl via
# Apache->server->add_config
use Apache::TestRequest 'GET';
my $res = GET "/apache/add_config";
if ($res->is_success) {
print $res->content;
}
else {
die "server side has failed (response code: ", $res->code, "),\n",
"see t/logs/error_log for more details\n";
}
1.24 +11 -0 modperl-2.0/t/conf/modperl_extra.pl
Index: modperl_extra.pl
===================================================================
RCS file: /home/cvs/modperl-2.0/t/conf/modperl_extra.pl,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- modperl_extra.pl 3 Feb 2003 22:56:19 -0000 1.23
+++ modperl_extra.pl 25 Mar 2003 04:49:06 -0000 1.24
@@ -45,6 +45,17 @@
$server->log->info("base server + $vhosts vhosts ready to run tests");
}
+# testing $s->add_config()
+my $conf = <<'EOC';
+# must use PerlModule here to check for segfaults
+PerlModule Apache::TestHandler
+<Location /apache/add_config>
+ SetHandler perl-script
+ PerlHandler Apache::TestHandler::ok1
+</Location>
+EOC
+Apache->server->add_config([split /\n/, $conf]);
+
use constant IOBUFSIZE => 8192;
sub ModPerl::Test::read_post {