Skip to content

Commit

Permalink
Merge pull request NixOS#9804 from edolstra/missing-nar-crash
Browse files Browse the repository at this point in the history
Fix crash when NAR is missing from binary cache

(cherry picked from commit 3b20cca)
Change-Id: I50ff18f4a6de69c323473b4a8e3e098d1f365145
  • Loading branch information
eldritch horrors committed Mar 4, 2024
1 parent 68f148e commit 298db5d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/libstore/build/worker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ void Worker::childTerminated(Goal * goal, bool wakeSleepers)

void Worker::waitForBuildSlot(GoalPtr goal)
{
debug("wait for build slot");
goal->trace("wait for build slot");
bool isSubstitutionGoal = goal->jobCategory() == JobCategory::Substitution;
if ((!isSubstitutionGoal && getNrLocalBuilds() < settings.maxBuildJobs) ||
(isSubstitutionGoal && getNrSubstitutions() < settings.maxSubstitutionJobs))
Expand Down
6 changes: 5 additions & 1 deletion src/libstore/local-store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,11 @@ void LocalStore::addToStore(const ValidPathInfo & info, Source & source,
Finally cleanup = [&]() {
if (!narRead) {
ParseSink sink;
parseDump(sink, source);
try {
parseDump(sink, source);
} catch (...) {
ignoreException();
}
}
};

Expand Down
5 changes: 5 additions & 0 deletions src/libstore/store-api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,11 @@ void copyStorePath(
RepairFlag repair,
CheckSigsFlag checkSigs)
{
/* Bail out early (before starting a download from srcStore) if
dstStore already has this path. */
if (!repair && dstStore.isValidPath(storePath))
return;

auto srcUri = srcStore.getUri();
auto dstUri = dstStore.getUri();
auto storePathS = srcStore.printStorePath(storePath);
Expand Down

0 comments on commit 298db5d

Please sign in to comment.