diff options
-rw-r--r-- | src/libstore/build.cc | 6 | ||||
-rw-r--r-- | src/libstore/store.cc | 5 | ||||
-rw-r--r-- | tests/Makefile.am | 3 | ||||
-rw-r--r-- | tests/dependencies.builder0.sh | 5 |
4 files changed, 14 insertions, 5 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); } diff --git a/tests/Makefile.am b/tests/Makefile.am index c88379e47f1f..3aa43417f1f3 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -39,7 +39,7 @@ gc-concurrent.sh: gc-concurrent.nix gc-concurrent2.nix TESTS = init.sh hash.sh lang.sh simple.sh dependencies.sh locking.sh parallel.sh \ build-hook.sh substitutes.sh substitutes2.sh fallback.sh nix-push.sh gc.sh \ gc-concurrent.sh verify.sh nix-pull.sh -#TESTS = init.sh gc-concurrent.sh +#TESTS = init.sh nix-push.sh nix-pull.sh XFAIL_TESTS = @@ -57,5 +57,6 @@ EXTRA_DIST = $(TESTS) \ substitutes.nix.in substituter.sh \ substitutes2.nix.in substituter2.sh \ gc-concurrent.nix.in gc-concurrent.builder.sh \ + gc-concurrent2.nix.in gc-concurrent2.builder.sh \ fallback.nix.in \ $(wildcard lang/*.nix) $(wildcard lang/*.exp) diff --git a/tests/dependencies.builder0.sh b/tests/dependencies.builder0.sh index 326e8dfbb8d3..69269916c605 100644 --- a/tests/dependencies.builder0.sh +++ b/tests/dependencies.builder0.sh @@ -3,4 +3,7 @@ export PATH=/bin:/usr/bin:$PATH mkdir $out echo $(cat $input1/foo)$(cat $input2/bar) > $out/foobar -ln -s $input2 $out/input-2 \ No newline at end of file +ln -s $input2 $out/input-2 + +# Self-reference. +ln -s $out $out/self |