aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-02-01 09:23:38 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-02-01 09:23:38 +0000
commit06b44242860d62e12f9abe018c6f974ceaa30bb9 (patch)
tree20a13dc912ca34f70eeb13276ab1dc6a45395615 /src
parent32fa82a56a2c4a937c91f72be16339b4ddf7cdf1 (diff)
* Add missing files to dist.
* Fix GC and substitute bugs related to self-references. Add a regression test.
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 dbfde447e..881f2dac8 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 396835013..c7b84e7c6 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);
}