Commit 277a192e authored by Mike Hibler's avatar Mike Hibler
Browse files

Work around bizarre perl behavior.

Whenever I invoke $image->hash() to get the SHA-1 hash of the image file,
I instead get back a ref to the internal Image.pm $self->{'HASH'} hash
where we store fields from the DB. At least this is the case on FreeBSD 10.3
(perl 5.20). Some odd interation with the AUTOLOAD function?

Anyway, just use $image->field('hash') instead.
parent 1029c365
......@@ -290,7 +290,7 @@ sub doimage($)
my $nhash = `$SHA1 $path`;
if ($? == 0 && $nhash =~ /^SHA1.*= ([\da-fA-F]+)$/) {
$nhash = lc($1);
if ($nhash ne $imobj->hash()) {
if ($nhash ne $imobj->field('hash')) {
print STDERR "$iname: file hash != DB hash for version $vers!\n";
print STDERR " use 'sudo imagevalidate -uU -V hash $fqname' to correct\n";
return 1;
......
......@@ -366,7 +366,8 @@ sub doimage($)
if (havedeltaimage($image)) {
$dpath = $image->DeltaImageFile();
}
$hash = $image->hash();
# XXX $image->hash() returns a ref to the internal 'HASH' hash.
$hash = $image->field('hash');
$dhash = $image->deltahash();
} else {
$isdir = 0;
......@@ -392,7 +393,7 @@ sub doimage($)
else {
if ($image->HaveFullImage()) {
$path = $image->FullImageFile();
$hash = $image->hash();
$hash = $image->field('hash');
} elsif ($image->HaveDeltaImage()) {
$dpath = $image->DeltaImageFile();
$dhash = $image->deltahash();
......@@ -406,7 +407,7 @@ sub doimage($)
#
elsif ($accessfs && -e $image->FullImagePath()) {
$path = $image->FullImageFile();
$hash = $image->hash();
$hash = $image->field('hash');
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment