about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-04-12T10·51+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-04-12T10·51+0000
commitf3660b1c8cba8e701689c82fc3fcaf3a3b8283da (patch)
tree3e921e95adb8941fd8eb82604e9f88a3232cdc84
parentd5219a351af4429ce0ca339940b7ae81717df4a6 (diff)
* Garbage collector fix: allow deletion of paths that have invalid
  (but substitutable) referers.

-rw-r--r--src/libstore/store.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libstore/store.cc b/src/libstore/store.cc
index 4e531bc4100f..d61c3e454705 100644
--- a/src/libstore/store.cc
+++ b/src/libstore/store.cc
@@ -737,10 +737,10 @@ void deleteFromStore(const Path & _path)
     Transaction txn(nixDB);
     if (isValidPathTxn(txn, path)) {
         PathSet referers = getReferers(txn, path);
-        if (referers.size() > 1 ||
-            (referers.size() == 1 &&
-                *referers.begin() != path))
-            throw Error(format("cannot delete path `%1%' because it is in use") % path);
+        for (PathSet::iterator i = referers.begin();
+             i != referers.end(); ++i)
+            if (*i != path && isValidPathTxn(txn, *i))
+                throw Error(format("cannot delete path `%1%' because it is in use by path `%2%'") % path % *i);
         invalidatePath(txn, path);
     }
     txn.commit();