CCL error message has no file name

Create issue
Issue #172 closed
Erik Schnetter created an issue

I just received the following fatal error message from Cactus:

Processing CCL files

CST error 1: -> Error parsing optional block line '' Missing { at start of block.

This error message does not tell me which thorn or file causes this.

Keyword:

Comments (8)

  1. Erik Schnetter reporter
    • removed comment

    Explanation: This problem was caused by a configuration.ccl file which had the line

    OPTIONAL LoopControl

    instead of

    OPTIONAL LoopControl { }

    That is, the curly braces were missing.

  2. Ian Hinder
    • removed comment

    Why are the curly braces even necessary? What sorts of things can go into the block?

  3. Steven R. Brandt
    • removed comment

    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 @@

    1. @@*/ 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)

  4. Frank Löffler
    • removed comment

    Can you please attach the patch as file to the ticket? This way things like whitespaces don't get mixed up. Thanks.

  5. Log in to comment