about summary refs log tree commit diff
path: root/src/libstore/gc.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-12-19T14·33+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-12-19T14·33+0100
commite775d4d84fe4b90464b00d560ceb79665301d79b (patch)
treeeb0585f5b22aa3609ff8a8d99292e3177687c10b /src/libstore/gc.cc
parentfbf0b2fa45c883f1f5e0c8f5397fcf62a4df9207 (diff)
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).
Diffstat (limited to 'src/libstore/gc.cc')
-rw-r--r--src/libstore/gc.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc
index ca16b6491009..fbf842350c74 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