diff options
author | regnat <rg@regnat.ovh> | 2020-09-17 13:36:58 +0200 |
---|---|---|
committer | regnat <rg@regnat.ovh> | 2020-09-17 13:36:58 +0200 |
commit | 520895b1dac1b82be9f571df3981a15cfada2968 (patch) | |
tree | bfb0b257b959c15a40e6d988dc71ae4bab82bb71 /src/libstore/gc.cc | |
parent | 609a6d6d9f1a8689c2336301a2e4db01ad20037c (diff) |
Fix garbage collection of CA derivations
Fix #4026
Diffstat (limited to 'src/libstore/gc.cc')
-rw-r--r-- | src/libstore/gc.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc index e6cbc525d..08b53c702 100644 --- a/src/libstore/gc.cc +++ b/src/libstore/gc.cc @@ -574,9 +574,12 @@ bool LocalStore::canReachRoot(GCState & state, StorePathSet & visited, const Sto /* If keep-derivations is set and this is a derivation, then don't delete the derivation if any of the outputs are alive. */ if (state.gcKeepDerivations && path.isDerivation()) { - for (auto & i : queryDerivationOutputs(path)) - if (isValidPath(i) && queryPathInfo(i)->deriver == path) - incoming.insert(i); + for (auto & [name, maybeOutPath] : queryPartialDerivationOutputMap(path)) + if (maybeOutPath && + isValidPath(*maybeOutPath) && + queryPathInfo(*maybeOutPath)->deriver == path + ) + incoming.insert(*maybeOutPath); } /* If keep-outputs is set, then don't delete this path if there |