Re: [BUG MP1/MP2] Apache should bail out in case of syntax errors in <Perl> section

[prev] [thread] [next] [Date index for 2005/03/04]

From: Stas Bekman
Subject: Re: [BUG MP1/MP2] Apache should bail out in case of syntax errors in <Perl> section
Date: 01:33 on 04 Mar 2005
Dominique Quatravaux wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Dear mod_perl developpers,
> 
> A syntactically incorrect <Perl> section does not prevent Apache from
> starting. I believe it should. Below is a short httpd.conf to
> reproduce this: despite the obvious syntax error, Apache starts fine
> and does not even complain to the logs. (mod_perl 1 does the same,
> plus it starts to randomly SEGV in children processes when queried).
> 
> FWIW when the <Perl> section is syntactically correct but the code
> throws an exception at run time (e.g. replace "})] BAD SYNTAX })]"
> below with "die;"), then everything happens as expected (the exception
> is sent to Apache's stderr and the Apache startup aborts).
> 
> I have an ugly workaround for this: set $PerlConfig to a deliberately
> bogus value in a BEGIN block at the top of the <Perl> section, and
> clear it at the end. If the parsing of the <Perl> section fails
> halfway through, the bogon left in $PerlConfig will subsequently cause
> Apache to abort :-]
> 
> Regards,
> 
> =====
> 
> LoadModule perl_module          /usr/lib/apache2/modules/mod_perl.so
> ServerRoot     /tmp
> ErrorLog       /tmp/log
> PidFile        /dev/null
> TypesConfig    /etc/mime.types
> Listen 12345
> 
> <Perl>
> use Apache2;
> })] BAD SYNTAX })]
> 1;
> </Perl>

Not sure what happens with mp1, but we did go through this with mp2. 
Unfortunately we can't have a test for this, since if the test suite 
doesn't start, we have a problem :( There should be a special small test 
suite for that I suppose.

I know Philippe is moving ships at the moment, so it might be some time 
before he replies, but I'll put it on the TODO list, so it doesn't fall 
between chairs.


        -- 
        __________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@xxxxxx.xxx http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Re: [BUG MP1/MP2] Apache should bail out in case of syntax errors in <Perl> section
Stas Bekman 01:33 on 04 Mar 2005

Generated at 08:54 on 14 Mar 2005 by mariachi v0.52