Be more robust wrt broken .narinfo files

This commit is contained in:
Eelco Dolstra 2015-06-03 15:19:32 +02:00
parent f0f30f594c
commit a64da5915d
1 changed files with 10 additions and 3 deletions

View File

@ -462,9 +462,16 @@ sub parseNARInfo {
return undef;
}
my $fingerprint = fingerprintPath(
$storePath, $narHash, $narSize,
[ map { "$Nix::Config::storeDir/$_" } @refs ]);
my $fingerprint;
eval {
$fingerprint = fingerprintPath(
$storePath, $narHash, $narSize,
[ map { "$Nix::Config::storeDir/$_" } @refs ]);
};
if ($@) {
warn "cannot compute fingerprint of $location; ignoring\n";
return undef;
}
if (!checkSignature($publicKey, decode_base64($sig64), $fingerprint)) {
warn "NAR info file $location has an incorrect signature; ignoring\n";