Menu

Bug in FlowGrapher_Analyze.cgi (and possibly somewhere else too)

2015-06-16
2015-06-16
  • linuxtardis

    linuxtardis - 2015-06-16

    Hello,
    While I was trying to set up FlowViewer, I found a bug: FlowGrapher Analysis doesn't convert input date format (chosen in FlowViewer_Configuration.pm) to it's internal date format. In our country, we use DD.MM.YYYY, but FlowViewer's internal format is MM/DD/YYYY, that's why Analysis refused to work for me. So I fixed it with this modification (I took conversion code from FlowViewer_Main.cgi):

    --- /opt/FlowViewer_4.6/FlowGrapher_Analyze.cgi 2015-02-12 01:20:49.000000000     +0100
    +++ FlowGrapher_Analyze.cgi 2015-06-16 16:09:17.469869476 +0200
    @@ -151,9 +151,31 @@
                     if ($saved_line =~ /END FILTERING/) { $found_parameters = 0;}
                     ($field,$field_value) = split(/: /,$saved_line);
                     if ($field eq "device_name")         { $device_name = $field_value; }
    -                if ($field eq "start_date")          { $start_date = $field_value; }
    -                if ($field eq "start_time")          { $start_time = $field_value; }
    -                if ($field eq "end_date")            { $end_date = $field_value; }
    +                if ($field eq "start_date")          { if ($date_format eq "DMY") {
    +                                ($temp_day_s,$temp_mnth_s,$temp_yr_s) = split(/\//,$field_value);
    +                        } elsif ($date_format eq "DMY2") {
    +                                ($temp_day_s,$temp_mnth_s,$temp_yr_s) = split(/\./,$field_value);
    +                        } elsif ($date_format eq "YMD") {
    +                                ($temp_yr_s,$temp_mnth_s,$temp_day_s) = split(/\-/,$field_value);
    +                        } else {
    +                                ($temp_mnth_s,$temp_day_s,$temp_yr_s) = split(/\//,$field_value);
    +                        }
    +                        $start_date = $temp_mnth_s ."/". $temp_day_s ."/". $temp_yr_s;}
    +                if ($field eq "start_time")          { 
    +           $start_time = $field_value; 
    +       }
    +                if ($field eq "end_date")            {
    +           if ($date_format eq "DMY") {
    +               ($temp_day_e,$temp_mnth_e,$temp_yr_e) = split(/\//,$field_value);
    +           } elsif ($date_format eq "DMY2") {
    +               ($temp_day_e,$temp_mnth_e,$temp_yr_e) = split(/\./,$field_value);
    +           } elsif ($date_format eq "YMD") {
    +               ($temp_yr_e,$temp_mnth_e,$temp_day_e) = split(/\-/,$field_value);
    +           } else {
    +               ($temp_mnth_e,$temp_day_e,$temp_yr_e) = split(/\//,$field_value);
    +           }
    +           $end_date   = $temp_mnth_e ."/". $temp_day_e ."/". $temp_yr_e;
    +       }
                     if ($field eq "end_time")            { $end_time = $field_value; }
                     if ($field eq "protocols")           { $protocols = $field_value; }
                     if ($field eq "bucket_size")         { $bucket_size = $field_value; }
    

    Sorry if I post this to wrong place, I don't know where I should post patches and bug reports.

     
    • Joe Loiacono

      Joe Loiacono - 2015-06-16

      Linuxtardis,

      Nice!

      I know others will benefit from this. Bartosz Brzeska also stumbled across the error. Hope to get a new version with the fix out soon (been very busy.)

      Thanks and regards,

      Joe

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.