From a64da5915d4023d256e1bda425ea6e10c1255812 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 3 Jun 2015 15:19:32 +0200 Subject: [PATCH] Be more robust wrt broken .narinfo files --- perl/lib/Nix/Manifest.pm | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/perl/lib/Nix/Manifest.pm b/perl/lib/Nix/Manifest.pm index 93c9c261..fb4a4646 100644 --- a/perl/lib/Nix/Manifest.pm +++ b/perl/lib/Nix/Manifest.pm @@ -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";