Skip Menu |

This queue is for tickets about the RRD-Editor CPAN distribution.

Report information
The Basics
Id: 81362
Status: resolved
Priority: 0/
Queue: RRD-Editor

People
Owner: Nobody in particular
Requestors: Olivier.Nicole [...] cs.ait.ac.th
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Miss handling of update --template
Date: Fri, 23 Nov 2012 15:34:10 +0700 (ICT)
To: bug-RRD-Editor [...] rt.cpan.org
From: Olivier Nicole <Olivier.Nicole [...] cs.ait.ac.th>
Hi, Today I tried to use RD::Editor with partial updates; defining a list of DS to update with --template. It always failed on me, telling me that it expect one value for each of the DS. I suggest the following patch that seems to solve the problem. I have not tested what would the result be is no template is used. what would be $#tmp then. The second problem, initialisation of @updvals was hidden by the fact you always provided all the DS in one update operation. Best regards, Olivier --- Editor.pm 2012-10-19 09:16:50.000000000 +0700 +++ Editor.pm 2012-11-23 14:57:47.000000000 +0700 @@ -954,7 +954,7 @@ # Parse template, if provided my $i; my $j; - my @tmp=split(/:/,$template); my @idx=(0 .. $rrd->{ds_cnt}-1); + my @tmp=split(/:/,$template); my @idx=(0 .. $#tmp>=0 ? $#tmp-1: $rrd->{ds_cnt}); for ($i=0; $i<@tmp; $i++) { $idx[$i]=$self->_findDSidx($tmp[$i]); if($idx[$i]<0) {croak("Unknown DS name ".$tmp[$i]."\n");} } @@ -976,7 +976,10 @@ } if ($current_time < $rrd->{last_up}) {croak("attempt to update using time $current_time when last update time is ". $rrd->{last_up}."\n");} $interval=$current_time - $rrd->{last_up}; - @updvals = "U" x $rrd->{ds_cnt}; # initialise values to NaN +# @updvals = "U" x $rrd->{ds_cnt}; # initialise values to NaN + for ($j=0; $j<$rrd->{ds_cnt}; $j++) { + $updvals[$j]="U"; + } for ($j=0; $j<@idx; $j++) { $updvals[$idx[$j]] = $bits[$j+1]; }
Thanks for pointing this out, and for the patch. I'll confirm a fix asap. Doug On Fri Nov 23 03:34:27 2012, Olivier.Nicole@cs.ait.ac.th wrote: Show quoted text
> Hi, > > Today I tried to use RD::Editor with partial updates; defining a list > of DS to update with --template. > > It always failed on me, telling me that it expect one value for each > of the DS. > > I suggest the following patch that seems to solve the problem. I have > not tested what would the result be is no template is used. what would > be $#tmp then. > > The second problem, initialisation of @updvals was hidden by the fact > you always provided all the DS in one update operation. > > Best regards, > > Olivier > > --- Editor.pm 2012-10-19 09:16:50.000000000 +0700 > +++ Editor.pm 2012-11-23 14:57:47.000000000 +0700 > @@ -954,7 +954,7 @@ > > # Parse template, if provided > my $i; my $j; > - my @tmp=split(/:/,$template); my @idx=(0 .. $rrd->{ds_cnt}-1); > + my @tmp=split(/:/,$template); my @idx=(0 .. $#tmp>=0 ? $#tmp-1: > $rrd->{ds_cnt}); > for ($i=0; $i<@tmp; $i++) { > $idx[$i]=$self->_findDSidx($tmp[$i]); if($idx[$i]<0) > {croak("Unknown DS name ".$tmp[$i]."\n");} > } > @@ -976,7 +976,10 @@ > } > if ($current_time < $rrd->{last_up}) {croak("attempt to > update using time $current_time when last update time is ". $rrd-
> >{last_up}."\n");}
> $interval=$current_time - $rrd->{last_up}; > - @updvals = "U" x $rrd->{ds_cnt}; # initialise values to NaN > +# @updvals = "U" x $rrd->{ds_cnt}; # initialise values to NaN > + for ($j=0; $j<$rrd->{ds_cnt}; $j++) { > + $updvals[$j]="U"; > + } > for ($j=0; $j<@idx; $j++) { > $updvals[$idx[$j]] = $bits[$j+1]; > }
Fixed in version 0.15