Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: ben+cpan [...] ritcey.com
Cc:
AdminCc:

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



Subject: Removing DS doesn't reduce file size by default and results in bad size in header
Date: Mon, 21 Oct 2013 14:45:50 -0400
To: bug-RRD-Editor [...] rt.cpan.org
From: Benjamin Ritcey <ben+cpan [...] ritcey.com>
I think it's an edit-in-place problem - if I call save() to a new file, it's fine but save() without an argument produces a bad .rrd file. This script: -- #!/usr/bin/perl use warnings; use strict; use RRD::Editor; my $rrd_file = shift @ARGV; my $rrd = RRD::Editor->new(); $rrd->open($rrd_file) or warn "Can't open $rrd_file: $!" and next; my @ds_names = $rrd->DS_names(); my $last = $ds_names[-1]; $rrd->delete_DS($last); $rrd->save() or warn "can't save file: $!"; $rrd->save('newfile.rrd') or warn "can't save new file: $!"; $rrd->open('newfile.rrd') or warn "Can't open $rrd_file: $!" and next; $rrd->open($rrd_file) or warn "Can't open $rrd_file: $!" and next; -- gives this result: Show quoted text
> ls -s orig.rrd
5248 orig.rrd Show quoted text
> ./rrd_editor_header_problem orig.rrd
orig.rrd size is incorrect (is 2684584 bytes but should be 2301312 bytes) at ./rrd_editor_header_problem line 21 Show quoted text
> ls -s1 *rrd
4496 newfile.rrd 5248 orig.rrd
Thanks, will look into it asap. Doug On Mon Oct 21 14:46:32 2013, ben+cpan@ritcey.com wrote: Show quoted text
> I think it's an edit-in-place problem - if I call save() to a new file, > it's fine but save() without an argument produces a bad .rrd file. > > This script: > -- > #!/usr/bin/perl > > use warnings; > use strict; > use RRD::Editor; > > my $rrd_file = shift @ARGV; > > my $rrd = RRD::Editor->new(); > $rrd->open($rrd_file) or warn "Can't open $rrd_file: $!" and next; > my @ds_names = $rrd->DS_names(); > > my $last = $ds_names[-1]; > > $rrd->delete_DS($last); > > $rrd->save() or warn "can't save file: $!"; > $rrd->save('newfile.rrd') or warn "can't save new file: $!"; > > $rrd->open('newfile.rrd') or warn "Can't open $rrd_file: $!" and next; > $rrd->open($rrd_file) or warn "Can't open $rrd_file: $!" and next; > >
Fixed. save() function was modified to truncate file after save.