Merge pull request #832 from wizeman/fix-hash-mismatch

Fix persistent hash mismatch errors when importing
This commit is contained in:
Graham Christensen 2021-03-02 16:04:23 -05:00 committed by GitHub
commit 68ac64dbd9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -447,14 +447,22 @@ void State::buildRemote(ref<Store> destStore,
for (auto & path : pathsSorted) { for (auto & path : pathsSorted) {
auto & info = infos.find(path)->second; auto & info = infos.find(path)->second;
to << cmdDumpStorePath << localStore->printStorePath(path);
to.flush();
/* Receive the NAR from the remote and add it to the /* Receive the NAR from the remote and add it to the
destination store. Meanwhile, extract all the info from the destination store. Meanwhile, extract all the info from the
NAR that getBuildOutput() needs. */ NAR that getBuildOutput() needs. */
auto source2 = sinkToSource([&](Sink & sink) auto source2 = sinkToSource([&](Sink & sink)
{ {
/* Note: we should only send the command to dump the store
path to the remote if the NAR is actually going to get read
by the destination store, which won't happen if this path
is already valid on the destination store. Since this
lambda function only gets executed if someone tries to read
from source2, we will send the command from here rather
than outside the lambda. */
to << cmdDumpStorePath << localStore->printStorePath(path);
to.flush();
TeeSource tee(from, sink); TeeSource tee(from, sink);
extractNarData(tee, localStore->printStorePath(path), narMembers); extractNarData(tee, localStore->printStorePath(path), narMembers);
}); });