On Thu, Mar 20, 2003 at 09:52:55AM +1100, Stas Bekman wrote:
> Joe Orton wrote:
> >On Tue, Feb 11, 2003 at 10:01:07AM +1100, Stas Bekman wrote:
> >
> >>Joe Orton wrote:
> >>
> >>>Since rev 1.63 of TestConfigPerl.pm I get this error running TEST (after
> >>>a fresh checkout)
> >>>
> >>>make[1]: Leaving directory 
> >>>`/home/joe/src/httpd-test/pf/c-modules/authany'
> >>>!!! configure() has failed:
> >>>Use of uninitialized value in subroutine entry at 
> >>>/home/joe/src/httpd-test/pf/t/../Apache-Test/lib/Apache/TestConfigPerl.pm 
> >>>line 318, <GEN48> line 18.
> >>>
> >>>backing down to r1.62 works fine. Any ideas? I'm using perl 5.8.0.
> >>
> >>I can't reproduce it. The difference between 1.62 and 1.63 is a big 
> >>refactoring of the code that parses the config sections.
> >>
> >>Can you please check what is undefined? $line, $indent? Also a trace of 
> >>calls that leads to this situation will help, which the following patch 
> >>should accomplish:
> >
> >
> >I think I've tracked this down: parse_vhost() can return undef when it's
> >passed a line like "<VirtualHost mod_nntp_like_ssl>" but
> >parse_vhost_open_tag() assumes otherwise and barfs doing $cfg-> in the
> >following lines.
> 
> Your example perfectly matches the regex in parse_vhost:
> 
> perl -le '$_ = "<VirtualHost mod_nntp_like_ssl>"; print $1||"", $2 if 
> /^(\s*)<VirtualHost\s+(?:_default_:)?(.*?)\s*>\s*$/'
> mod_nntp_like_ssl
> 
> or is it something else? I mean what causes the undef to be returned, that 
> I was unable to reproduce with perl-framework tests?

It's this bit that returns undef I think:

    if ($module =~ /^mod_/ and not $mods->{$have_module}) {
        return undef;
    }

> >This seems to fix it for me (and the config file produced doesn't cause
> >httpd to barf), is this OK to checkin?
> 
> Otherwise it's certainly a good fix. thanks Joe!
> 
> Just a slight change before you commit: since the returned value is either 
> a hash ref or undef, there is no need to check for defined $cfg, but just 
> true/false $cfg. Also I'd write it the other way around:

Thanks Stas - I'll check this in.

...

Reply via email to