about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2011-09-12T09·07+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2011-09-12T09·07+0000
commit13114daa3e38abc5c84987830d9276b93251592f (patch)
tree9e26ad9846c4ea827fdc80cbdf9dc4848e39c455 /src/libstore
parent281e3ed0590f253ef717a1f82123dfc569a110a1 (diff)
* Ouch. A store upgrade could cause a substituter to be triggered,
  causing a deadlock.

Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/derivations.cc3
-rw-r--r--src/libstore/local-store.cc6
-rw-r--r--src/libstore/local-store.hh2
3 files changed, 6 insertions, 5 deletions
diff --git a/src/libstore/derivations.cc b/src/libstore/derivations.cc
index 5a0f4ecc69e0..97343d57d478 100644
--- a/src/libstore/derivations.cc
+++ b/src/libstore/derivations.cc
@@ -239,7 +239,8 @@ Hash hashDerivationModulo(StoreAPI & store, Derivation drv)
     foreach (DerivationInputs::const_iterator, i, drv.inputDrvs) {
         Hash h = drvHashes[i->first];
         if (h.type == htUnknown) {
-            Derivation drv2 = derivationFromPath(store, i->first);
+            assert(store.isValidPath(i->first));
+            Derivation drv2 = parseDerivation(readFile(i->first));
             h = hashDerivationModulo(store, drv2);
             drvHashes[i->first] = h;
         }
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index 6ad4c84c69ff..702ff67e793e 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -510,7 +510,7 @@ void LocalStore::checkDerivationOutputs(const Path & drvPath, const Derivation &
 }
 
 
-unsigned long long LocalStore::addValidPath(const ValidPathInfo & info)
+unsigned long long LocalStore::addValidPath(const ValidPathInfo & info, bool checkOutputs)
 {
     SQLiteStmtUse use(stmtRegisterValidPath);
     stmtRegisterValidPath.bind(info.path);
@@ -540,7 +540,7 @@ unsigned long long LocalStore::addValidPath(const ValidPathInfo & info)
            derivations).  Note that if this throws an error, then the
            DB transaction is rolled back, so the path validity
            registration above is undone. */
-        checkDerivationOutputs(info.path, drv);
+        if (checkOutputs) checkDerivationOutputs(info.path, drv);
         
         foreach (DerivationOutputs::iterator, i, drv.outputs) {
             SQLiteStmtUse use(stmtAddDerivationOutput);
@@ -1521,7 +1521,7 @@ void LocalStore::upgradeStore6()
     SQLiteTxn txn(db);
     
     foreach (PathSet::iterator, i, validPaths) {
-        addValidPath(queryPathInfoOld(*i));
+        addValidPath(queryPathInfoOld(*i), false);
         std::cerr << ".";
     }
 
diff --git a/src/libstore/local-store.hh b/src/libstore/local-store.hh
index 8cf6b66406a9..7ef01b2644b4 100644
--- a/src/libstore/local-store.hh
+++ b/src/libstore/local-store.hh
@@ -226,7 +226,7 @@ private:
 
     unsigned long long queryValidPathId(const Path & path);
 
-    unsigned long long addValidPath(const ValidPathInfo & info);
+    unsigned long long addValidPath(const ValidPathInfo & info, bool checkOutputs = true);
         
     void addReference(unsigned long long referrer, unsigned long long reference);