Skip to content

Bug: Error message for .rab file open failure references wrong variable ($netfile instead of $rabfile) #296

Description

@akutuva21

Summary

In MacroBNGModel.pm, when opening the .rab output file for writing, the die message incorrectly prints $netfile instead of $rabfile. If the write-open fails, the error will blame the wrong file.

Location

File: bng2/Perl2/MacroBNGModel.pm, line 991

Current behavior

$rabfile = "macr_${param_prefix}.rab";
$netfile = "macr_${param_prefix}.net";
open (RFILEnet, "<", $netfile) or die "Can't open $netfile: $!\n";
open (WFILErab, ">", $rabfile) or die "Can't open $netfile: $!\n";
#                                                  ^^^^^^^^
#                                          Should be $rabfile

If the .rab file can't be opened for writing (e.g., permissions issue), the error message will say:

Can't open macr_foo.net: Permission denied

...when the actual problem is with macr_foo.rab.

Expected behavior

open (WFILErab, ">", $rabfile) or die "Can't open $rabfile: $!\n";

How to verify

sed -n '988,992p' bng2/Perl2/MacroBNGModel.pm

Suggested fix

Change $netfile to $rabfile in the die string on line 991.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions