summaryrefslogtreecommitdiff
path: root/nix
diff options
context:
space:
mode:
authorHugo Buddelmeijer <hugo@buddelmeijer.nl>2026-06-30 17:42:10 +0200
committerLudovic Courtès <ludo@gnu.org>2026-07-01 09:08:53 +0200
commit85571d27d2e830fd7f6e96dc4df7f92a30ff3c2e (patch)
treedf97f972f2342e387b0f7ae738f13ed92d1bf7ff /nix
parent636a104836fe00fca5844e15e3c40c9cf5cd1427 (diff)
daemon: Don't delete files from the store with guix build -K --rounds=3 --check.
Specifying all three of -K, --check, --rounds=3 caused valid packages to be deleted from the store. When `buildMode == bmCheck`, the built package is not renamed from `actualPath` to `i.second.path. Then later, when `settings.keepFailed` and `curRound < nrRounds`, `i.second.path` was renamed to `i.second.path + "-check"` anyway. * nix/libstore/build.cc (DerivationGoal::registerOutputs): Add check for bmCheck before renaming store path. * tests/store.scm ("build-things, check mode"): Ensure file is a valid path. ("build-things, check mode + keep-failed"): New test. Fixes: #9631. Change-Id: I31d24b2349f563867b8101a1b5ce3c10896ce165 Co-authored-by: Ludovic Courtès <ludo@gnu.org> Signed-off-by: Ludovic Courtès <ludo@gnu.org> Merges: #9632
Diffstat (limited to 'nix')
-rw-r--r--nix/libstore/build.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc
index 85be95d557f..b94bca5359a 100644
--- a/nix/libstore/build.cc
+++ b/nix/libstore/build.cc
@@ -3370,7 +3370,10 @@ void DerivationGoal::registerOutputs()
3370 assert(false); // shouldn't happen 3370 assert(false); // shouldn't happen
3371 } 3371 }
3372 3372
3373 if (settings.keepFailed) { 3373 /* Rename the built package when doing multiple rounds, but
3374 don't move the package when running in check mode, since
3375 that would remove the valid package from the store. */
3376 if (settings.keepFailed && buildMode != bmCheck) {
3374 for (auto & i : drv.outputs) { 3377 for (auto & i : drv.outputs) {
3375 Path prev = i.second.path + checkSuffix; 3378 Path prev = i.second.path + checkSuffix;
3376 if (pathExists(prev)) deletePath(prev); 3379 if (pathExists(prev)) deletePath(prev);