mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 14:06:16 +02:00
nix-store: fix out of sync protocol
If a NAR is already in the store, addToStore doesn't read the source which makes the protocol go out of sync. This happens for example when two client try to nix-copy-closure the same derivation at the same time.
This commit is contained in:
parent
91b00b145f
commit
b226b5cd97
1 changed files with 10 additions and 2 deletions
|
@ -950,8 +950,16 @@ static void opServe(Strings opFlags, Strings opArgs)
|
|||
info.sigs = readStrings<StringSet>(in);
|
||||
in >> info.ca;
|
||||
|
||||
// FIXME: race if addToStore doesn't read source?
|
||||
store->addToStore(info, in, NoRepair, NoCheckSigs);
|
||||
if (info.narSize == 0) {
|
||||
throw Error("narInfo is too old and missing the narSize field");
|
||||
}
|
||||
|
||||
SizedSource sizedSource(in, info.narSize);
|
||||
|
||||
store->addToStore(info, sizedSource, NoRepair, NoCheckSigs);
|
||||
|
||||
// consume all the data that has been sent before continuing.
|
||||
sizedSource.drainAll();
|
||||
|
||||
out << 1; // indicate success
|
||||
|
||||
|
|
Loading…
Reference in a new issue