about summary refs log tree commit diff
path: root/src/libstore/build.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/build.cc')
-rw-r--r--src/libstore/build.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index a8ef9b23efaf..2ebcbf5a8fc3 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -1986,6 +1986,15 @@ void DerivationGoal::computeClosure()
         info.deriver = drvPath;
         infos.push_back(info);
     }
+
+    /* Mutually recursive outputs are not allowed */
+    foreach (ValidPathInfos::iterator, i, infos)
+        foreach (ValidPathInfos::iterator, j, infos)
+            if ((i->path != j->path) &&
+                (i->references.find(j->path) != i->references.end()) &&
+                (j->references.find(i->path) != j->references.end())) 
+                    throw BuildError(format("Mutually referential outputs are not allowed: outputs `%1%' and `%2%' refer to each other") % i->path % j->path);
+
     worker.store.registerValidPaths(infos);
 
     /* It is now safe to delete the lock files, since all future