From e775d4d84fe4b90464b00d560ceb79665301d79b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 19 Dec 2012 15:33:09 +0100 Subject: [PATCH] If gc-keep-derivations is set, only keep the actual deriver This prevents zillions of derivations from being kept, and fixes an infinite recursion in the garbage collector (due to an obscure cycle that can occur with fixed-output derivations). --- src/libstore/gc.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc index ca16b6491..fbf842350 100644 --- a/src/libstore/gc.cc +++ b/src/libstore/gc.cc @@ -473,7 +473,7 @@ bool LocalStore::tryToDelete(GCState & state, const Path & path) if (state.gcKeepDerivations && isDerivation(p)) { PathSet outputs = queryDerivationOutputs(p); foreach (PathSet::iterator, i, outputs) - if (isValidPath(*i)) todo.insert(*i); + if (isValidPath(*i) && queryDeriver(*i) == p) todo.insert(*i); } /* If gc-keep-outputs is set, then don't delete this path if there are derivers of this path that are not