If you use the restore option with a partial pref file not containing a version, you will have this error. Also the count of updated prefs will be one too high.
This is corrected by a better test of the hash value in the CheckVersionPref subroutine.
Test plan:
[1] Create a small pref file and remove the version pref (if present). You
could for instance do a pref backup and remove most lines.
[2] Use the restore option with and without this patch.
So, something like:
maintclone/misc/maintenance/cmp_sysprefs.pl -c r -f 9999crucial.pref
[3] Check on the error message and the pref count.
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
sub CheckVersionPref { #additional precaution
#if there are versions, compare them
my ($hash) = @_;
- my $hv = $hash->{version}->{value};
+ my $hv = exists $hash->{version}? $hash->{version}->{value}: undef;
return if !defined $hv;
my ($dv) = $dbh->selectrow_array(
'SELECT value FROM systempreferences