Article View: news.software.nntp
Article #67714Re: error in Daily Usenet report
From: Sasko Stefanovski
Date: Mon, 19 Jan 2004 23:39
Date: Mon, 19 Jan 2004 23:39
206 lines
8283 bytes
8283 bytes
To locate the problem, I extracted the code from innreport that parses
the configuration file as a separate script. The scripts is appended at
the end of this posting.
1.
When I execute this script on a machine running RHEL AS 3.0 which has
installed perl v5.8.0 (rpm perl-5.8.0-88.4) I'am getting the follwing
output:
Error in /usr/local/news/etc/innreport.conf line 12: must be 'section'
instead of '#'
2.
When executed on a machine running RH 7.2 with perl v5.6.1 everything is
fine.
3.
When executed on RH 9 with perl v5.8.0 (rpm perl-5.8.0-88.3) the same
error as in step 1.
It seems that the perl v5.8.0 has something to do with the above
mentioned behavior.
Just to note that innreport.conf file that a was using is the one that
comes with the distrubution of inn-2.4.0
Sasko
==========================================
#! /usr/bin/perl
sub Decode_Config_File {
my $file = shift;
my ($line, $section);
my $linenum = 0;
my $info;
my @list;
open (FILE, "$file") || die "Can\'t open config file \"$file\".
Abort.\n";
while (defined ($line = <FILE>)) {
$linenum++;
last if eof (FILE);
($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
die "Error in $file line $linenum: must be 'section' instead of
'$info'\n"
unless ($info eq 'section');
($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
die "Error in $file line $linenum: invalid section name '$info'\n"
unless $info =~ /^\w+$/;
print "section $info {\n" if $DEBUG;
$section = $info;
($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
die "Error in $file line $linenum: must be a '{' instead of '$info'\n"
unless ($info eq '{');
($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
push @list, $section;
while ($info ne '}') { # it is a block
last if eof (FILE);
my $keyword = $info;
($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
my $value = $info;
if ($info eq '{') { # it is a sub-block
my @a;
$output{$section}{$keyword} = \@a unless $output{$section}{$keyword};
my %hash;
print "\t$keyword {\n" if $DEBUG;
($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
my @sublist; # to store the "data" blocks
while ($info ne '}') {
last if eof (FILE);
my $subkeyword = $info;
($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
my $subvalue = $info;
if ($info eq '{') {
# it is a sub-sub-block
my %subhash;
print "\t\t$subkeyword {\n" if $DEBUG;
my @b;
$hash{$subkeyword} = \@b unless ${hash}{$subkeyword};
($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
while ($info ne '}') {
last if eof (FILE);
my $subsubkeyword = $info;
($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
my $subsubvalue = $info;
if ($info eq '{') {
die "Error in $file line $linenum: too many blocks.\n";
}
else {
($info, $linenum, $line) =
&read_conf ($linenum, $line, \*FILE);
die "Error in $file line $linenum: must be a ';' instead " .
"of '$info'\n" unless ($info eq ';');
print "\t\t\t$subsubkeyword\t$subsubvalue;\n" if $DEBUG;
$subhash{$subsubkeyword} = $subsubvalue;
($info, $linenum, $line) =
&read_conf ($linenum, $line, \*FILE);
}
}
($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
die "Error in $file line $linenum: must be a ';' instead of " .
"'$info'\n" unless $info eq ';';
push @{$hash{$subkeyword}} , \%subhash;
($info, $linenum, $line) = &read_conf ($linenum, $line,
\*FILE);
print "\t\t};\n" if $DEBUG;
}
else {
($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
die "Error in $file line $linenum: must be a ';' instead " .
"of '$info'\n" unless $info eq ';';
print "\t\t$subkeyword\t$subvalue;\n" if $DEBUG;
$hash{$subkeyword} = $subvalue;
($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
}
}
($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
die "Error in $file line $linenum: must be a ';' instead of
'$info'\n"
unless $info eq ';';
push @{$output{$section}{$keyword}}, \%hash;
($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
print "\t};\n" if $DEBUG;
}
else {
($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
die "Error in $file line $linenum: must be a ';' instead of
'$info'\n"
unless $info eq ';';
print "\t$keyword\t$value;\n" if $DEBUG;
$output{$section}{$keyword} = $value;
($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
}
}
die "Error in $file line $linenum: must be a '}' instead of '$info'\n"
unless $info eq '}';
($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
die "Error in $file line $linenum: must be a ';' instead of '$info'\n"
unless $info eq ';';
print "};\n\n" if $DEBUG;
}
close FILE;
$output{'_order_'} = \@list;
}
sub read_conf {
my ($linenum, $line, $file) = @_;
*FILE = *$file;
$line =~ s,^\s+,,o; # remove useless blanks
$line =~ s,^(\#|//).*$,,o; # remove comments (at the beginning)
while (($line =~ m/^$/o || $line =~ m/^\"[^\"]*$/o) && !(eof (FILE))) {
$line .= <FILE>; # read one line
$linenum++;
$line =~ s,^\s*,,om; # remove useless blanks
$line =~ s,^(\#|//).*$,,om; # remove comments (at the beginning)
}
$line =~ s/^( # at the beginning
[{};] # match '{', '}', or ';'
| # OR
\" # a double quoted string
(?:\\.|[^\"\\])*
\"
| # OR
[^{};\"\s]+ # a word
)\s*//mox;
my $info = $1;
if (defined $info && $info) {
chomp $info;
}
else {
warn "Syntax error in conf file line $linenum.\n";
}
return ($info, $linenum, $line);
}
# The following lines are not part of the distribution and are added
# just to drive the above procedures
$file = "/usr/local/news/etc/innreport.conf";
&Decode_Config_File ($file);
==================================================
Sasko Stefanovski wrote:
> I am seeing the following in the Daily Usenet report:
>
> Error in /usr/local/news/etc/innreport.conf line 12: must be 'section'
> instead of '#'
> ---------
>
> But what is confusing is that line 12 of that file is correct:
> section default {
>
> It used to work fine for this server which was promoted recently to from
> slave to master server.
>
> Any ideas?
>
> Sasko
>
>
>
Technical Details
Message-ID:
<buhps6$me$1@rumor.richmond.edu>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20140818.mbox.gz!intern1.nntp.aus1.giganews.com!internal1.nntp.sjc.giganews.com!border2.nntp.sjc.giganews.com!nntp.giganews.com!newshub.sdsu.edu!logbridge.uoregon.edu!arclight.uoregon.edu!news.tufts.edu!uunet!dca.uu.net!ash.uu.net!hearst.acc.Virginia.EDU!gossip.richmond.edu!not-for-mailReferences:
<buem3o$k55$1@rumor.richmond.edu>Show Full Headers
Complete Article Headers
Message-ID: <buhps6$me$1@rumor.richmond.edu> Subject: Re: error in Daily Usenet report Date: Mon, 19 Jan 2004 18:39:48 -0500 From: Sasko Stefanovski <sstefano@richmond.edu> References: <buem3o$k55$1@rumor.richmond.edu> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20140818.mbox.gz!intern1.nntp.aus1.giganews.com!internal1.nntp.sjc.giganews.com!border2.nntp.sjc.giganews.com!nntp.giganews.com!newshub.sdsu.edu!logbridge.uoregon.edu!arclight.uoregon.edu!news.tufts.edu!uunet!dca.uu.net!ash.uu.net!hearst.acc.Virginia.EDU!gossip.richmond.edu!not-for-mail Newsgroups: news.software.nntp Organization: University of Richmond Lines: 206 NNTP-Posting-Host: ppp065051.richmond.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: rumor.richmond.edu 1074555592 718 141.166.65.51 (19 Jan 2004 23:39:52 GMT) X-Complaints-To: usenet@rumor.richmond.edu NNTP-Posting-Date: Mon, 19 Jan 2004 23:39:52 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; X-Accept-Language: en-us, en In-Reply-To: <buem3o$k55$1@rumor.richmond.edu>