From 9e4177bc674733ed5cec32c6ffdd12ee3ca16ece Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 17 Oct 2025 13:07:41 -0400 Subject: [PATCH] Fix issue #14287 The test added in the previous commit now passes. Co-authored-by: Eelco Dolstra (cherry picked from commit de192794c9f5a4dbd4fb6735277140f2161d9d79) --- src/libstore/build/derivation-building-goal.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/libstore/build/derivation-building-goal.cc b/src/libstore/build/derivation-building-goal.cc index 001816ca0..310b2bf84 100644 --- a/src/libstore/build/derivation-building-goal.cc +++ b/src/libstore/build/derivation-building-goal.cc @@ -860,7 +860,15 @@ Goal::Co DerivationBuildingGoal::tryToBuild() { builder.reset(); StorePathSet outputPaths; - for (auto & [_, output] : builtOutputs) { + /* In the check case we install no store objects, and so + `builtOutputs` is empty. However, per issue #14287, there is + an expectation that the post-build hook is still executed. + (This is useful for e.g. logging successful deterministic rebuilds.) + + In order to make that work, in the check case just load the + (preexisting) infos from scratch, rather than relying on what + `DerivationBuilder` returned to us. */ + for (auto & [_, output] : buildMode == bmCheck ? checkPathValidity(initialOutputs).second : builtOutputs) { // for sake of `bmRepair` worker.markContentsGood(output.outPath); outputPaths.insert(output.outPath);