Skip to content

Commit 1099ef0

Browse files
lovesegfaultgithub-actions[bot]
authored andcommitted
fix(libstore/build/derivation-goal): don't assert on partially valid outputs
Fixes: #14130 (cherry picked from commit 9eecee3)
1 parent f434a3e commit 1099ef0

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/libstore/build/derivation-goal.cc

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,23 @@ Goal::Co DerivationGoal::haveDerivation()
182182
}
183183
}
184184

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

0 commit comments

Comments
 (0)