Revert "libstore: don't delete already valid outputs after build"
This reverts commit 4ef56601b5 as this is an insufficient fix for the critical correctness bug.
Change-Id: I7885c437ce4df25002d92654312b3b1bae53bfa3
This commit is contained in:
committed by
Raito Bezarius
parent
3d446ea37e
commit
2310539e66
@@ -2098,11 +2098,6 @@ SingleDrvOutputs LocalDerivationGoal::registerOutputs()
|
||||
before this for loop. */
|
||||
if (*scratchPath != finalStorePath)
|
||||
outputRewrites[std::string { scratchPath->hashPart() }] = std::string { finalStorePath.hashPart() };
|
||||
/* Cancel automatic deletion of that output if it was a scratch output that we just
|
||||
* registered. */
|
||||
if (auto cleaner = scratchOutputsCleaner.extract(outputName)) {
|
||||
cleaner.mapped().cancel();
|
||||
}
|
||||
};
|
||||
|
||||
auto orifu = get(outputReferencesIfUnregistered, outputName);
|
||||
@@ -2418,6 +2413,10 @@ SingleDrvOutputs LocalDerivationGoal::registerOutputs()
|
||||
the next iteration */
|
||||
if (newInfo.ca) {
|
||||
localStore.registerValidPaths({{newInfo.path, newInfo}});
|
||||
/* Cancel automatic deletion of that output if it was a scratch output. */
|
||||
if (auto cleaner = scratchOutputsCleaner.extract(outputName)) {
|
||||
cleaner.mapped().cancel();
|
||||
}
|
||||
}
|
||||
|
||||
infos.emplace(outputName, std::move(newInfo));
|
||||
@@ -2446,6 +2445,13 @@ SingleDrvOutputs LocalDerivationGoal::registerOutputs()
|
||||
infos2.insert_or_assign(newInfo.path, newInfo);
|
||||
}
|
||||
localStore.registerValidPaths(infos2);
|
||||
|
||||
/* Cancel automatic deletion of that output if it was a scratch output that we just registered. */
|
||||
for (auto & [outputName, _ ] : infos) {
|
||||
if (auto cleaner = scratchOutputsCleaner.extract(outputName)) {
|
||||
cleaner.mapped().cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* In case of a fixed-output derivation hash mismatch, throw an
|
||||
|
||||
@@ -81,10 +81,3 @@ testCert present fixed-output "$certsymlink"
|
||||
|
||||
# Symlinks should be added in the sandbox directly and not followed
|
||||
nix-sandbox-build symlink-derivation.nix
|
||||
|
||||
# Regression fj#883: derivations outputs disappearing after rebuild
|
||||
# build the derivation for both its outputs and delete one of them.
|
||||
# simulates substitution or copying only one output from a builder.
|
||||
nix-store --delete $(nix-sandbox-build --no-out-link ./regression-fj883.nix -A base.lib)
|
||||
# build a derivation depending on previous one. this should succeed
|
||||
nix-sandbox-build --no-out-link ./regression-fj883.nix -A downstream
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
with import ./config.nix;
|
||||
|
||||
rec {
|
||||
base = mkDerivation {
|
||||
name = "base";
|
||||
outputs = [ "out" "lib" ];
|
||||
buildCommand = "echo > $out; echo > $lib";
|
||||
};
|
||||
|
||||
downstream = mkDerivation {
|
||||
name = "downstream";
|
||||
deps = [ base.out base.lib ];
|
||||
buildCommand = "echo $deps > $out";
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user