about summary refs log tree commit diff
path: root/src/libstore/normalise.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-02-13T10·45+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-02-13T10·45+0000
commit6f5a5ea5ea7fa80bc709c4a2b14ea4395ebe7469 (patch)
tree3ae280df5c902c73dc3652804e911af5c17eb171 /src/libstore/normalise.cc
parent1ad9d1124727dd48beaec36b006bba856350905d (diff)
* Regression fix: realise substitutes and detect cycles.
Diffstat (limited to 'src/libstore/normalise.cc')
-rw-r--r--src/libstore/normalise.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libstore/normalise.cc b/src/libstore/normalise.cc
index 51f90207ea..5c13f04ecb 100644
--- a/src/libstore/normalise.cc
+++ b/src/libstore/normalise.cc
@@ -287,6 +287,12 @@ void ensurePath(const Path & path, PathSet pending)
 {
     /* If the path is already valid, we're done. */
     if (isValidPath(path)) return;
+
+    if (pending.find(path) != pending.end())
+      throw Error(format(
+          "path `%1%' already being realised (possible substitute cycle?)")
+	  % path);
+    pending.insert(path);
     
     /* Otherwise, try the substitutes. */
     Paths subPaths = querySubstitutes(path);
@@ -296,7 +302,8 @@ void ensurePath(const Path & path, PathSet pending)
     {
         checkInterrupt();
         try {
-            normaliseStoreExpr(*i, pending);
+            Path nf = normaliseStoreExpr(*i, pending);
+	    realiseClosure(nf, pending);
             if (isValidPath(path)) return;
             throw Error(format("substitute failed to produce expected output path"));
         } catch (Error & e) {