From 6a888ec29a6724f916f96508b3a94a86c643c18e Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <edolstra@gmail.com>
Date: Fri, 8 Sep 2017 14:48:08 +0200
Subject: [PATCH] copyStorePath(): Fill in missing narHash regardless of
 checkSigs

I don't remember what the reasoning was here, but security is provided
by the signatures, not by whether the hash is provided by the other
store.
---
 src/libstore/store-api.cc | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc
index 7a8a3f7de..fa6ade750 100644
--- a/src/libstore/store-api.cc
+++ b/src/libstore/store-api.cc
@@ -593,23 +593,19 @@ void copyStorePath(ref<Store> srcStore, ref<Store> dstStore,
     MyStringSink sink(progress);
     srcStore->narFromPath({storePath}, sink);
 
-    if (!info->narHash && !checkSigs) {
+    if (!info->narHash) {
         auto info2 = make_ref<ValidPathInfo>(*info);
         info2->narHash = hashString(htSHA256, *sink.s);
         if (!info->narSize) info2->narSize = sink.s->size();
         info = info2;
     }
 
-    assert(info->narHash);
-
     if (info->ultimate) {
         auto info2 = make_ref<ValidPathInfo>(*info);
         info2->ultimate = false;
         info = info2;
     }
 
-    assert(info->narHash);
-
     dstStore->addToStore(*info, sink.s, repair, checkSigs);
 }
 
-- 
GitLab