[ET Trac] [Einstein Toolkit] #172: CCL error message has no file name
Einstein Toolkit
trac-noreply at einsteintoolkit.org
Tue Feb 15 11:24:01 CST 2011
#172: CCL error message has no file name
-----------------------+----------------------------------------------------
Reporter: eschnett | Owner: sbrandt
Type: defect | Status: assigned
Priority: major | Milestone:
Component: Cactus | Version:
Resolution: | Keywords:
-----------------------+----------------------------------------------------
Comment (by sbrandt):
The bug was a little worse than described. In the event of missing {}'s,
the code actually went into an endless loop. The culprit was the while
immediately following the error message. It was not capable of detecting
end of file (i.e. when $data->[$line_number] became undefined). I added
checks to ensure $data->[$Line_number] was defined in two additional while
loops.
$ svn diff lib/sbin/ConfigurationParser.pl
Index: lib/sbin/ConfigurationParser.pl
===================================================================
--- lib/sbin/ConfigurationParser.pl (revision 4684)
+++ lib/sbin/ConfigurationParser.pl (working copy)
@@ -207,7 +207,7 @@
}
elsif($line =~ m/^\s*OPTIONAL\s*/i)
{
- ($optional, $define, $line_number) =
&ParseOptionalBlock($line_number, \@data);
+ ($optional, $define, $line_number) = &ParseOptionalBlock($filename,
$line_number, \@data);
$cfg->{"\U$thorn\E OPTIONAL"} .= "$optional ";
$cfg->{"\U$thorn\E OPTIONAL \U$optional\E DEFINE"} = $define;
}
@@ -249,13 +249,13 @@
$line_number++;
if($data->[$line_number] !~ m/^\s*\{\s*$/)
{
- &CST_error (0, "Error parsing provides block line
'$data->[$line_number]'.".
+ &CST_error (0, "Error parsing provides block line
'$data->[$line_number]' $file_name:$line_number ".
'Missing { at start of block');
- $line_number++ while($data->[$line_number] !~ m:\s*\}\s*:);
+ $line_number++ while(defined($data->[$line_number]) and
$data->[$line_number] !~ m:\s*\}\s*:);
}
else
{
- while($data->[$line_number] !~ m:\s*\}\s*:)
+ while(defined($data->[$line_number]) and $data->[$line_number] !~
m:\s*\}\s*:)
{
$line_number++;
if($data->[$line_number] =~ m/^\s*SCRIPT\s*(.*)$/i)
@@ -299,7 +299,7 @@
#@@*/
sub ParseOptionalBlock
{
- my ($line_number, $data) = @_;
+ my ($file_name, $line_number, $data) = @_;
my ($optional, $define);
$data->[$line_number] =~ m/^\s*OPTIONAL\s*(.*)/i;
@@ -312,13 +312,13 @@
if($data->[$line_number] !~ m/^\s*\{\s*$/)
{
- &CST_error (0, "Error parsing optional block line
'$data->[$line_number]'".
+ &CST_error (0, "Error parsing optional block line
'$data->[$line_number]' $file_name:$line_number".
' Missing { at start of block.');
- $line_number++ while($data->[$line_number] !~ m:\s*\}\s*:);
+ $line_number++ while(defined($data->[$line_number]) and
$data->[$line_number] !~ m:\s*\}\s*:);
}
else
{
- while($data->[$line_number] !~ m:\s*\}\s*:)
+ while(defined($data->[$line_number]) and $data->[$line_number] !~
m:\s*\}\s*:)
{
$line_number++;
if($data->[$line_number] =~ m/^\s*DEFINE\s*(.*)$/i)
--
Ticket URL: <https://trac.einsteintoolkit.org/ticket/172#comment:4>
Einstein Toolkit <http://einsteintoolkit.org>
The Einstein Toolkit
More information about the Trac
mailing list