about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libstore/build.cc6
-rw-r--r--src/libstore/store.cc5
2 files changed, 8 insertions, 3 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index dbfde447e48b..881f2dac8899 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -1329,7 +1329,8 @@ void SubstitutionGoal::init()
 
     for (PathSet::iterator i = references.begin();
          i != references.end(); ++i)
-        addWaitee(worker.makeSubstitutionGoal(*i));
+        if (*i != storePath) /* ignore self-references */
+            addWaitee(worker.makeSubstitutionGoal(*i));
 
     if (waitees.empty()) /* to prevent hang (no wake-up event) */
         referencesValid();
@@ -1347,7 +1348,8 @@ void SubstitutionGoal::referencesValid()
 
     for (PathSet::iterator i = references.begin();
          i != references.end(); ++i)
-        assert(isValidPath(*i));
+        if (*i != storePath) /* ignore self-references */
+            assert(isValidPath(*i));
     
     tryNext();
 }
diff --git a/src/libstore/store.cc b/src/libstore/store.cc
index 396835013f05..c7b84e7c63fc 100644
--- a/src/libstore/store.cc
+++ b/src/libstore/store.cc
@@ -553,7 +553,10 @@ void deleteFromStore(const Path & _path)
 
     Transaction txn(nixDB);
     if (isValidPathTxn(txn, path)) {
-        if (getReferers(txn, path).size() > 0)
+        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);
         invalidatePath(path, txn);
     }