about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2007-08-28T16·22+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2007-08-28T16·22+0000
commitcb1c1004cdd582abe67146ab3904bd88de3a1d4e (patch)
treec03c2d1a60ea418cf72119ccf09d961fb997c600 /src/libstore
parentc970b28ba0f8866bde800849120d429d781ccb5d (diff)
* When there are multiple substituters, make sure to release the
  lock on the output path after trying each.  Otherwise the
  pathIsLockedByMe() test gets confused.

Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/build.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 5ad81050060c..85933e84f2f2 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -1310,6 +1310,10 @@ DerivationGoal::PrepareBuildReply DerivationGoal::prepareBuild()
     /* Obtain locks on all output paths.  The locks are automatically
        released when we exit this function or Nix crashes. */
     /* !!! BUG: this could block, which is not allowed. */
+    /* !!! and once we make this non-blocking, we should carefully
+       consider the case where some but not all locks are required; we
+       should then release the acquired locks so that the other
+       processes and the pathIsLockedByMe() test don't get confused. */
     outputLocks.lockPaths(outputPaths(drv.outputs),
         (format("waiting for lock on %1%") % showPaths(outputPaths(drv.outputs))).str());
 
@@ -2080,6 +2084,7 @@ void SubstitutionGoal::tryToRun()
     /* Maybe a derivation goal has already locked this path
        (exceedingly unlikely, since it should have used a substitute
        first, but let's be defensive). */
+    outputLock.reset(); // make sure this goal's lock is gone
     if (pathIsLockedByMe(storePath)) {
         debug(format("restarting substitution of `%1%' because it's locked by another goal")
             % storePath);