Finally, I think I've been able to reproduce your error.

For some reason, some entries in the %ENV hash will cause a failure.
In my case, I get a failed assertion and not a core, but I suspect it
has to do with the fact that my perl is compiled with debugging.

Attached is a small addition to the existing env tests that expose this
strange behaviour.  For me, all env entries can safely be deleted,
except for the following 4:

PERL_LWP_USE_HTTP_10
MOD_PERL
MODPERL_EXTRA_PL
GATEWAY_INTERFACE

each attempt to delete that entry will result in this error:

Assertion ((sv)->sv_flags & (0x00002000|0x00004000|0x00008000)) failed:
file "mg.c", line 59

I am looking at it a bit more, but I think Doug could maybe have a quick
look and enlighten us on this issue... 

At least, the following patch exposes the problem.

Gozer out.

Index: t/response/TestModperl/env.pm
===================================================================
RCS file: /home/cvspublic/modperl-2.0/t/response/TestModperl/env.pm,v
retrieving revision 1.2
diff -u -I'$Id' -I'$Revision' -r1.2 env.pm
--- t/response/TestModperl/env.pm       11 Apr 2002 11:08:44 -0000      1.2
+++ t/response/TestModperl/env.pm       17 Oct 2002 06:51:05 -0000
@@ -7,13 +7,14 @@
 use APR::Table ();
 
 use Apache::Test;
+use Apache::TestUtil;
 
 use Apache::Const -compile => 'OK';
 
 sub handler {
     my $r = shift;
 
-    plan $r, tests => 20;
+    plan $r, tests => 20 + keys(%ENV);
 
     my $env = $r->subprocess_env;
 
@@ -59,6 +60,15 @@
 
     ok $ENV{SERVER_SOFTWARE};
     ok $env->get('SERVER_SOFTWARE');
+    
+    #Make sure each key can be deleted, see 
+    
+#[EMAIL PROTECTED]">http://mathforum.org/epigone/modperl-dev/blexbixji/[EMAIL PROTECTED]
+    #for more details on this bug report
+    
+    for my $key (sort keys %ENV) {
+        eval { delete $ENV{$key}; };
+        ok t_cmp('', $@, $key);
+    }
 
     Apache::OK;
 }

On Thu, 2002-10-17 at 09:26, Philippe M. Chiasson wrote:
> On Thu, 2002-10-17 at 06:43, Bradley Baetz wrote:
> > Hmm, I wasn't subscribed to teh dev list, and this doesn't seem to have 
> > made it to the archives. Sorry if people get this twice.
> 
> I've tried to reproduce this with the same configurations you have with
> no luck ;-(
> 
> Could you maybe send me your complet httpd.conf, see if I can just get
> the darn thing to segfault on me...
> 
> Gozer out.
>  
> > Bradley
> > 
> > ---------- Forwarded message ----------
> > Date: Wed, 16 Oct 2002 13:37:50 +1000 (EST)
> > From: Bradley Baetz <[EMAIL PROTECTED]>
> > To: Philippe M. Chiasson <[EMAIL PROTECTED]>
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: [mp2] segfault deleting ENV variable
> > 
> > On 16 Oct 2002, Philippe M. Chiasson wrote:
> > 
> > > On Tue, 2002-10-15 at 21:22, Bradley Baetz wrote:
> > > > The following one line script will cause apache/mod_perl2 to segfault:
> > > > 
> > > > delete @::ENV{'PATH'};
> > > 
> > > $ENV{'PATH'} would be slightly more modern ;-)
> > 
> > :) The original line was:
> > 
> > delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
> > 
> > as taken from |perldoc perlsec| (and slightly modified to include PATH)
> > 
> > > 
> > > > 
> > > > I've tried this with both apache-2.0.40/mod_perl-1.99_05/perl-5.8.0 (ie
> > > > stock RH8), and apache-2.0.43/mod_perl-1.99_07/perl-5.8.0
> > > 
> > > I just tried with both the configuration you list here, and no
> > > segfaults.
> > > 
> > 
> > Are you sure that $ENV{PATH} has a value? Try deleting QUERY_STRING, or 
> > MOD_PERL.
> > 
> > The script is really simple. I've attached it, but it literally is just
> > the one line.
> > 
> > I've also attached my .htaccess file. The .htaccess isn't causing it, 
> > though - adding to httpd.conf:
> > 
> > <Files foo.cgi>
> >   SetHandler perl-script
> >   PerlResponseHandler ModPerl::PerlRun
> >   Options +ExecCGI
> > </Files>
> > 
> > directly, and running w/o a .htaccess file produces the same result.
> > 
> > With that, and a debug mod_perl, I get the following backtrace for 
> > http://localhost/foo.cgi:
> > 
> > #0  0x40253447 in Perl_mg_clear ()
> >    from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
> > #1  0x4025b989 in Perl_hv_delete_ent ()
> >    from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
> > #2  0x4028802e in Perl_pp_delete ()
> >    from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
> > #3  0x40260059 in Perl_runops_standard ()
> >    from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
> > #4  0x40208139 in S_call_body ()
> >    from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
> > #5  0x40207eb6 in Perl_call_sv ()
> >    from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
> > #6  0x401cae93 in modperl_callback (my_perl=0x81517f0, handler=0x80fee70,
> >     p=0x81601e8, r=0x8160220, s=0x80b9358, args=0x816885c)
> >     at modperl_callback.c:53
> > #7  0x401cb523 in modperl_callback_run_handlers (idx=6, type=4, 
> > r=0x8160220,
> >     c=0x0, s=0x80b9358, pconf=0x0, plog=0x0, ptemp=0x0)
> >     at modperl_callback.c:180
> > #8  0x401cb5fa in modperl_callback_per_dir (idx=6, r=0x8160220)
> >     at modperl_callback.c:202
> > #9  0x401c59c0 in modperl_response_handler_run (r=0x8160220, finish=0)
> >     at mod_perl.c:709
> > #10 0x401c5bf5 in modperl_response_handler_cgi (r=0x8160220) at 
> > mod_perl.c:771
> > #11 0x0807c4f0 in ap_run_handler (r=0x8160220) at config.c:195
> > #12 0x0807cad6 in ap_invoke_handler (r=0x8160220) at config.c:401
> > #13 0x0806afc7 in ap_process_request (r=0x8160220) at http_request.c:288
> > #14 0x08066be1 in ap_process_http_connection (c=0x815bdc8) at 
> > http_core.c:293
> > #15 0x08086268 in ap_run_process_connection (c=0x815bdc8) at 
> > connection.c:85
> > #16 0x08086555 in ap_process_connection (c=0x815bdc8, csd=0x815bcf8)
> >     at connection.c:207
> > #17 0x0807ae0d in child_main (child_num_arg=1651076143) at prefork.c:696
> > #18 0x0807afd4 in make_child (s=0x80b9358, slot=0) at prefork.c:736
> > #19 0x0807b041 in startup_children (number_to_start=5) at prefork.c:808
> > #20 0x0807b7bf in ap_mpm_run (_pconf=0x80ab53c, plog=0x80eed30, 
> > s=0x80b9358)
> >     at prefork.c:1024
> > #21 0x08080d8e in main (argc=2, argv=0xbffff8f4) at main.c:643
> > #22 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6
> > 
> > modperl_env.c is beyond my perl knowledge to try to work out whats going 
> > wrong, though.
> > 
> > Bradley
> > ----
> > 
> 
> > delete $ENV{'PATH'};
> > ----
> > 
> 
> > <Files foo.cgi>
> >   SetHandler perl-script
> >   PerlResponseHandler ModPerl::PerlRun
> >   Options +ExecCGI
> > </Files>
> > ----
> > 
> 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> 

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to