diff options
-rw-r--r-- | src/libstore/gc.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc index cf073c5d9..87e0a05bc 100644 --- a/src/libstore/gc.cc +++ b/src/libstore/gc.cc @@ -563,6 +563,15 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results) state.gcKeepOutputs = queryBoolSetting("gc-keep-outputs", false); state.gcKeepDerivations = queryBoolSetting("gc-keep-derivations", true); + + /* Using `--ignore-liveness' with `--delete' can have unintended + consequences if `gc-keep-outputs' or `gc-keep-derivations' are + true (the garbage collector will recurse into deleting the + outputs or derivers, respectively). So disable them. */ + if (options.action == GCOptions::gcDeleteSpecific && options.ignoreLiveness) { + state.gcKeepOutputs = false; + state.gcKeepDerivations = false; + } /* Acquire the global GC root. This prevents a) New roots from being added. |