Skip Menu |

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

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

People
Owner: MBASUNOV [...] cpan.org
Requestors: MBASUNOV [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in:
  • 0.01
  • 0.01_1
  • 0.01_2
  • 0.01_3
  • 0.01_4
  • 0.01_5
  • 0.01_6
  • 0.02
  • 0.03
  • 0.04
  • 0.05
  • 0.06
  • 0.07
  • 0.08
  • 0.08_1
  • 0.08_2
  • 0.09
  • 0.10
  • 0.10_1
  • 0.11
  • 0.12
  • 0.14
  • 0.15
  • 0.16
  • 0.17
  • 0.18
Fixed in: 0.19



Subject: resize_RRA does not rely to ptr leading to datashift which broke RRA data
resize_RRA must rely to ptr when increasing/decreasing size. Suggested fix: sub resize_RRA { my ($self, $idx, $size) = @_; my $rrd=$self->{rrd}; if ($idx > $rrd->{rra_cnt} || $idx<0) {croak("RRA index out of range\n");} if ($size < 0) {$size=0;} # load RRA data, if not already loaded if (!defined($rrd->{dataloaded})) {$self->_loadRRAdata;} # update data my $row_cnt = $rrd->{rra}[$idx]->{row_cnt}; my $ptr = $rrd->{rra}[$idx]->{ptr}; my $empty = $self->_packd([(NAN)x$rrd->{ds_cnt}]); if ($size > $row_cnt) { # Expand splice( @{$rrd->{rra}[$idx]->{data}}, $ptr+1, 0, ( ($empty)x($size-$row_cnt) ) ); } elsif ($size < $row_cnt) { # Shrink; removing tail my $cnt_strip = $row_cnt-$size; my $tail = ($ptr+1 + $cnt_strip > $size ? $row_cnt - $ptr-1 : $cnt_strip); splice(@{$rrd->{rra}[$idx]->{data}}, $ptr+1, $tail); # then removing head if remainder splice(@{$rrd->{rra}[$idx]->{data}}, 0, $cnt_strip-$tail) if $tail < $cnt_strip; } $rrd->{rra}[$idx]->{row_cnt} = $size; return 1; }
Taken into 0.19