Skip to content

Commit

Permalink
Use 'eval' when querying the blocklist
Browse files Browse the repository at this point in the history
32bit perl erros out if you pack/unpack 64bit integers.
  • Loading branch information
mlschroe committed Jun 11, 2018
1 parent 53e16c7 commit f0f652a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build-vm
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ vm_wrapup_build() {
echo "... saving built packages"
swapoff "$VM_SWAP"
pushd "$BUILD_ROOT$TOPDIR" >/dev/null
find "$@" -print0 | computeblocklists --padstart 512 --padend 512 -v --manifest - -0 > "$VM_SWAP"
find "$@" -print0 | computeblocklists --padstart 512 --padend 512 -v --manifest - -0 > "$VM_SWAP" || cleanup_and_exit 1
popd >/dev/null
fi
}
Expand Down
15 changes: 9 additions & 6 deletions computeblocklists
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ sub fibmap_blocklist($$$) {
my $FIBMAP = 1;
if (not defined ioctl($fd, 1, $block)) {
if (not defined ioctl($fd, alt_ioctl($FIBMAP), $block)) {
return undef;
die("fibmap ioctl: $!\n");
}
}
$block = unpack('I', $block);
Expand Down Expand Up @@ -114,7 +114,7 @@ sub fiemap_blocklist($$$) {

if (not defined ioctl($file, $FIEMAP, $x)) {
if (not defined ioctl($file, alt_ioctl($FIEMAP), $x)) {
return undef;
die("fiemap ioctl: $!\n");
}
}

Expand Down Expand Up @@ -286,12 +286,15 @@ while (1) {

print "f $n $st_size $bsize";

if (not defined fiemap_blocklist($fd, $st_size, $bsize)) {
if (not defined fibmap_blocklist($fd, $st_size, $bsize)) {
die "Couldn't get block list for $n: $!\n";
eval { fiemap_blocklist($fd, $st_size, $bsize) };
if ($@) {
warn($@);
eval { fibmap_blocklist($fd, $st_size, $bsize) };
if ($@) {
warn($@);
die "Could not get block list for $n\n";
}
}

print "\n";
close($fd);
}
Expand Down

0 comments on commit f0f652a

Please sign in to comment.