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.
This commit is contained in:
Eelco Dolstra 2017-09-08 14:48:08 +02:00
parent 3cf1705583
commit 6a888ec29a
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -593,23 +593,19 @@ void copyStorePath(ref<Store> srcStore, ref<Store> dstStore,
MyStringSink sink(progress); MyStringSink sink(progress);
srcStore->narFromPath({storePath}, sink); srcStore->narFromPath({storePath}, sink);
if (!info->narHash && !checkSigs) { if (!info->narHash) {
auto info2 = make_ref<ValidPathInfo>(*info); auto info2 = make_ref<ValidPathInfo>(*info);
info2->narHash = hashString(htSHA256, *sink.s); info2->narHash = hashString(htSHA256, *sink.s);
if (!info->narSize) info2->narSize = sink.s->size(); if (!info->narSize) info2->narSize = sink.s->size();
info = info2; info = info2;
} }
assert(info->narHash);
if (info->ultimate) { if (info->ultimate) {
auto info2 = make_ref<ValidPathInfo>(*info); auto info2 = make_ref<ValidPathInfo>(*info);
info2->ultimate = false; info2->ultimate = false;
info = info2; info = info2;
} }
assert(info->narHash);
dstStore->addToStore(*info, sink.s, repair, checkSigs); dstStore->addToStore(*info, sink.s, repair, checkSigs);
} }