Skip to content

Commit 795d7bb

Browse files
lovesegfaultEricson2314
authored andcommitted
fix(libstore/build/derivation-goal): don't assert on partially valid outputs
Fixes: #14130 (cherry picked from commit 9eecee3)
1 parent 7358e50 commit 795d7bb

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)