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

View file

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