about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-05-04T13·39+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-05-04T14·16+0200
commitc6a21aed07520e11dfae09cf9eff9e34e60906d8 (patch)
tree409f7f78244020c62b02c46eef733e05a55cedf6
parent538a64e8c314f23ba0c5d76201f1c20e71884a21 (diff)
More GC fixes
-rw-r--r--src/libstore/gc.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc
index 8fc582f4c2..f4cb672cde 100644
--- a/src/libstore/gc.cc
+++ b/src/libstore/gc.cc
@@ -265,7 +265,7 @@ void LocalStore::findRoots(const Path & path, unsigned char type, Roots & roots)
 {
     auto foundRoot = [&](const Path & path, const Path & target) {
         Path storePath = toStorePath(target);
-        if (isValidPath(storePath))
+        if (isStorePath(storePath) && isValidPath(storePath))
             roots[path] = storePath;
         else
             printMsg(lvlInfo, format("skipping invalid root from ‘%1%’ to ‘%2%’") % path % storePath);
@@ -351,7 +351,7 @@ void LocalStore::findRuntimeRoots(PathSet & roots)
     for (auto & i : paths)
         if (isInStore(i)) {
             Path path = toStorePath(i);
-            if (roots.find(path) == roots.end() && isValidPath(path)) {
+            if (roots.find(path) == roots.end() && isStorePath(path) && isValidPath(path)) {
                 debug(format("got additional root ‘%1%’") % path);
                 roots.insert(path);
             }
@@ -402,7 +402,7 @@ void LocalStore::deletePathRecursive(GCState & state, const Path & path)
 
     unsigned long long size = 0;
 
-    if (isValidPath(path)) {
+    if (isStorePath(path) && isValidPath(path)) {
         PathSet referrers;
         queryReferrers(path, referrers);
         for (auto & i : referrers)
@@ -473,7 +473,7 @@ bool LocalStore::canReachRoot(GCState & state, PathSet & visited, const Path & p
 
     visited.insert(path);
 
-    if (!isValidPath(path)) return false;
+    if (!isStorePath(path) || !isValidPath(path)) return false;
 
     PathSet incoming;
 
@@ -516,7 +516,7 @@ void LocalStore::tryToDelete(GCState & state, const Path & path)
 
     Activity act(*logger, lvlDebug, format("considering whether to delete ‘%1%’") % path);
 
-    if (!isValidPath(path)) {
+    if (!isStorePath(path) || !isValidPath(path)) {
         /* A lock file belonging to a path that we're building right
            now isn't garbage. */
         if (isActiveTempFile(state, path, ".lock")) return;