From 93227ff65c73e726c4ceef0cdd9439e7a4301417 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 31 Aug 2011 21:11:50 +0000 Subject: * Eliminate all uses of the global variable ‘store’ from libstore. This should also fix: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit nix-instantiate: ./../boost/shared_ptr.hpp:254: T* boost::shared_ptr::operator->() const [with T = nix::StoreAPI]: Assertion `px != 0' failed. which was caused by hashDerivationModulo() calling the ‘store’ object (during store upgrades) before openStore() assigned it. --- src/libexpr/primops.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/libexpr/primops.cc') diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 9d226a327017..0e81f7b72fae 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -357,7 +357,7 @@ static void prim_derivationStrict(EvalState & state, Value * * args, Value & v) runs. */ if (path.at(0) == '=') { path = string(path, 1); - PathSet refs; computeFSClosure(path, refs); + PathSet refs; computeFSClosure(*store, path, refs); foreach (PathSet::iterator, j, refs) { drv.inputSrcs.insert(*j); if (isDerivation(*j)) @@ -433,7 +433,7 @@ static void prim_derivationStrict(EvalState & state, Value * * args, Value & v) /* Use the masked derivation expression to compute the output path. */ - Hash h = hashDerivationModulo(drv); + Hash h = hashDerivationModulo(*store, drv); foreach (DerivationOutputs::iterator, i, drv.outputs) if (i->second.path == "") { @@ -444,7 +444,7 @@ static void prim_derivationStrict(EvalState & state, Value * * args, Value & v) } /* Write the resulting term into the Nix store directory. */ - Path drvPath = writeDerivation(drv, drvName); + Path drvPath = writeDerivation(*store, drv, drvName); printMsg(lvlChatty, format("instantiated `%1%' -> `%2%'") % drvName % drvPath); @@ -452,7 +452,7 @@ static void prim_derivationStrict(EvalState & state, Value * * args, Value & v) /* Optimisation, but required in read-only mode! because in that case we don't actually write store derivations, so we can't read them later. */ - drvHashes[drvPath] = hashDerivationModulo(drv); + drvHashes[drvPath] = hashDerivationModulo(*store, drv); state.mkAttrs(v, 1 + drv.outputs.size()); mkString(*state.allocAttr(v, state.sDrvPath), drvPath, singleton("=" + drvPath)); -- cgit 1.4.1