From 9bcb4d2dd99ba7509c27479eecf1e7ac88244fa8 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 12 Feb 2018 22:48:55 +0100 Subject: Fix hang in build-remote --- src/build-remote/build-remote.cc | 2 +- src/libstore/local-store.cc | 1 - src/libstore/local-store.hh | 3 +++ 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/build-remote/build-remote.cc b/src/build-remote/build-remote.cc index df579729af29..c6e75e8cc704 100644 --- a/src/build-remote/build-remote.cc +++ b/src/build-remote/build-remote.cc @@ -241,7 +241,7 @@ connected: if (!missing.empty()) { Activity act(*logger, lvlTalkative, actUnknown, fmt("copying outputs from '%s'", storeUri)); - setenv("NIX_HELD_LOCKS", concatStringsSep(" ", missing).c_str(), 1); /* FIXME: ugly */ + store->locksHeld.insert(missing.begin(), missing.end()); /* FIXME: ugly */ copyPaths(ref(sshStore), store, missing, NoRepair, NoCheckSigs, substitute); } diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index 8a79fc7235fa..4afe51ea91ec 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -992,7 +992,6 @@ void LocalStore::addToStore(const ValidPathInfo & info, const ref & /* Lock the output path. But don't lock if we're being called from a build hook (whose parent process already acquired a lock on this path). */ - static auto locksHeld = tokenizeString(getEnv("NIX_HELD_LOCKS")); if (!locksHeld.count(info.path)) outputLock.lockPaths({realPath}); diff --git a/src/libstore/local-store.hh b/src/libstore/local-store.hh index 30bef3a799d4..bbd50e1c1451 100644 --- a/src/libstore/local-store.hh +++ b/src/libstore/local-store.hh @@ -104,6 +104,9 @@ private: public: + // Hack for build-remote.cc. + PathSet locksHeld = tokenizeString(getEnv("NIX_HELD_LOCKS")); + /* Initialise the local store, upgrading the schema if necessary. */ LocalStore(const Params & params); -- cgit 1.4.1