From 779e795732d8d1e6ada77039b6e4cf0d10051ba6 Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Fri, 27 Jun 2025 15:38:53 +0200 Subject: [PATCH] libstore: fix scratch output cleanup the daemon must use real store paths, not virtual store paths. using virtual paths may inadvertently delete paths in the system nix store when a build was run on a redirected store as root, which isn't good Change-Id: Id048b236bda0e0ab1f3be6ccba0ddc1de2a3e941 --- src/libstore/build/local-derivation-goal.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libstore/build/local-derivation-goal.cc b/src/libstore/build/local-derivation-goal.cc index cfcda1311..8837ac25d 100644 --- a/src/libstore/build/local-derivation-goal.cc +++ b/src/libstore/build/local-derivation-goal.cc @@ -530,7 +530,9 @@ void LocalDerivationGoal::startBuilder() /* Schedule this scratch output path for automatic deletion * if we do not cancel it, e.g. when registering the outputs. */ - scratchOutputsCleaner.insert_or_assign(outputName, worker.store.printStorePath(scratchPath)); + scratchOutputsCleaner.emplace( + outputName, worker.store.toRealPath(worker.store.printStorePath(scratchPath)) + ); /* Substitute output placeholders with the scratch output paths. We'll use during the build. */