Skip to content

Commit 5d14e91

Browse files
authored
Merge pull request #14519 from NixOS/backport-14137-to-2.31-maintenance
[Backport 2.31-maintenance] fix(libstore/build/derivation-goal): don't assert on partially valid outputs
2 parents 1e92560 + 795d7bb commit 5d14e91

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/libstore/build/derivation-goal.cc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,16 @@ Goal::Co DerivationGoal::haveDerivation()
182182
}
183183
}
184184

185-
if (buildResult.success())
186-
assert(buildResult.builtOutputs.count(wantedOutput) > 0);
185+
if (buildResult.success()) {
186+
/* If the wanted output is not in builtOutputs (e.g., because it
187+
was already valid and therefore not re-registered), we need to
188+
add it ourselves to ensure we return the correct information. */
189+
if (buildResult.builtOutputs.count(wantedOutput) == 0) {
190+
debug(
191+
"BUG! wanted output '%s' not in builtOutputs, working around by adding it manually", wantedOutput);
192+
buildResult.builtOutputs = {{wantedOutput, assertPathValidity()}};
193+
}
194+
}
187195
}
188196

189197
co_return amDone(g->exitCode, g->ex);

0 commit comments

Comments
 (0)