Skip to content

Commit 9ccbe23

Browse files
committed
DerivationBuilder Change missing initialOutput if..throw to assert
Since this goal has no (goal-wide) notion of "wanted outputs" (we're building the derivation, and thus making all outputs), we should have `initialOutputs` for all outputs, and if we're missing one that's an internal error caused by a bug in Nix. Concretely, `DerivationBuildingGoal::gaveUpOnSubstitution` now clearly does create `initialOutputs` for all outputs, whereas a few commits ago that was not obvious, so I feel confident in saying that this invariant that should be upheld, in fact is upheld. `scatchOutputs` is initialized for every initial output, so the same change to it follows for the same reasons.
1 parent 870bb68 commit 9ccbe23

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/libstore/unix/build/derivation-builder.cc

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,18 +1456,14 @@ SingleDrvOutputs DerivationBuilderImpl::registerOutputs()
14561456
std::map<std::string, struct stat> outputStats;
14571457
for (auto & [outputName, _] : drv.outputs) {
14581458
auto scratchOutput = get(scratchOutputs, outputName);
1459-
if (!scratchOutput)
1460-
throw BuildError(
1461-
"builder for '%s' has no scratch output for '%s'", store.printStorePath(drvPath), outputName);
1459+
assert(scratchOutput);
14621460
auto actualPath = realPathInSandbox(store.printStorePath(*scratchOutput));
14631461

14641462
outputsToSort.insert(outputName);
14651463

14661464
/* Updated wanted info to remove the outputs we definitely don't need to register */
14671465
auto initialOutput = get(initialOutputs, outputName);
1468-
if (!initialOutput)
1469-
throw BuildError(
1470-
"builder for '%s' has no initial output for '%s'", store.printStorePath(drvPath), outputName);
1466+
assert(initialOutput);
14711467
auto & initialInfo = *initialOutput;
14721468

14731469
/* Don't register if already valid, and not checking */

0 commit comments

Comments
 (0)