Skip Menu |

This queue is for tickets about the Config-General CPAN distribution.

Report information
The Basics
Id: 7957
Status: resolved
Priority: 0/
Queue: Config-General

People
Owner: Nobody in particular
Requestors: nwetters [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.27
Fixed in: (no value)



Subject: cannot parse Apache_1.3.31 httpd.conf
This is a valid httpd.conf block, describing the default (root) directory permissions: <Directory /> Options FollowSymLinks AllowOverride None </Directory> It throws an error when parsed by Config::General. The block is contained within the default httpd.conf shipped with Apache_1.3.31. See also: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=31652 p.s. I think the Apache config syntax is mad to allow this kind of rubbish.
(RT doesn't notify me of new bugs, so sorry for the late reply.) No this is wrong, it works. Script: #!/usr/bin/perl -w use strict; use Data::Dumper; use Config::General; my %hash = ParseConfig(-ConfigFile => shift() ); print Dumper(\%hash); Output: $VAR1 = { 'Directory' => { '/' => { 'Options' => 'ExecCGI' } } };
[TLINDEN - Fri May 27 07:50:07 2005]: Show quoted text
> No this is wrong, it works.
No it doesn't. Using the code you supplied against the snippet of the conf file listed below, which is in the default httpd.conf in Apache 1.3.33 and previous versions. [ngourlay@home ~]$ cat foo.pl #!/usr/bin/perl -w use strict; use Data::Dumper; use Config::General; my %hash = ParseConfig(-ConfigFile => shift() ); print Dumper(\%hash); [ngourlay@home ~]$ cat bar.conf <Directory /> Options FollowSymLinks AllowOverride None </Directory> [ngourlay@home ~]$ perl foo.pl bar.conf EndBlock "</Directory>" has no StartBlock statement (level: 1, chunk 5)! at foo.pl line 5
Show quoted text
> > No this is wrong, it works.
> No it doesn't.
Actually, you're right. The problem was: I tried it at work, where an older version of the module is installed. Today I found the cause of the bug, which has been incorporated in version 2.25: [changelog] - added feature suggested by Eric Andreychek <eric@openthought.net>: now block statements like this are allowed: "<directory blah/>" which is called an explicit empty block. This generates just an empty hash-ref and saves writing. In fact, internally it will be converted to: <directory blah> </directory> [changelog] This new code in stage 1 (General::_read() ) now considers <Directory /> as such an empty block. It adds a closing tag </Directory> so that the parser in stage 2 (General::_parse() ) gets the expected result (the empty hash). So, here is how the config looks like internally after stage 1 then: <Directory></Directory> </Directory> Now there are 2 closing tags for this block, which causes the actual error message from the parser. Unfortunately I'm unsure how to fix this. Maybe I will add an additional flag which turns on the above feature... I need to think about it, please be patient. kind regards, Tom PS: and, excuse me for the invalid conclusion earlier in this ticket.
Show quoted text
> I need to think about it, please be patient.
It's impossible to reconcile apache conf files with xml-type syntax, as apache allows unquoted paths in directives: <foobar />...</foobar> meaning 'the root directory is an argument to the foobar directive'. Anyone familiar with xml would probably read the tags as 'open and close the foobar tag, then close it again'. If your module is to parse correctly both types of file, one must be chosen as the default behaviour, and one chosen as an option. I'd suggest the apache behaviour should not be the default. Show quoted text
> PS: and, excuse me for the invalid conclusion earlier in this ticket.
no problem - you are excused ;)
Show quoted text
> If your module is to parse correctly both types of file, one must be > chosen as the default behaviour, and one chosen as an option. I'd > suggest the apache behaviour should not be the default.
Since the current default behavior is not to use apaches syntax, I will add a flag which turns is off. - Tom
fixed in version 2.30, added flag -SlashIsDirectory.