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
This commit is contained in:
eldritch horrors
2025-06-27 16:37:08 +02:00
parent 151cb75236
commit 779e795732
+3 -1
View File
@@ -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. */