diff --git a/src/libexpr/eval-cache.cc b/src/libexpr/eval-cache.cc index 13bc1b8ea64..0f892f9c320 100644 --- a/src/libexpr/eval-cache.cc +++ b/src/libexpr/eval-cache.cc @@ -381,11 +381,6 @@ AttrPath AttrCursor::getAttrPath(Symbol name) const return attrPath; } -std::string toAttrPathStr(EvalState & state, const AttrPath & attrPath) -{ - return dropEmptyInitThenConcatStringsSep(".", state.symbols.resolve(attrPath)); -} - std::string AttrCursor::getAttrPathStr() const { return getAttrPath().to_string(root->state); diff --git a/src/libfetchers/git-utils.cc b/src/libfetchers/git-utils.cc index 5f7b8ab2e6d..f21313a1040 100644 --- a/src/libfetchers/git-utils.cc +++ b/src/libfetchers/git-utils.cc @@ -709,6 +709,7 @@ struct GitRepoImpl : GitRepo, std::enable_shared_from_this keyDecoded = base64::decode(k.key); } catch (Error & e) { e.addTrace({}, "while decoding public key '%s' used for git signature", k.key); + throw; } auto fingerprint = trim(hashString(HashAlgorithm::SHA256, keyDecoded).to_string(nix::HashFormat::Base64, false), "="); @@ -1121,6 +1122,13 @@ struct GitFileSystemObjectSinkImpl : GitFileSystemObjectSink { } + ~GitFileSystemObjectSinkImpl() + { + // Make sure the worker threads are destroyed before any state + // they're referring to. + workers.shutdown(); + } + struct Child; /// A directory to be written as a Git tree. diff --git a/src/libstore/build-result.cc b/src/libstore/build-result.cc index c9ac7d60b7e..4967b64423d 100644 --- a/src/libstore/build-result.cc +++ b/src/libstore/build-result.cc @@ -2,8 +2,6 @@ #include "nix/util/json-utils.hh" #include -#include - namespace nix { bool BuildResult::operator==(const BuildResult &) const noexcept = default; diff --git a/src/libutil/hash.cc b/src/libutil/hash.cc index e3d4bb4a8a2..ea71ffff5dc 100644 --- a/src/libutil/hash.cc +++ b/src/libutil/hash.cc @@ -19,8 +19,6 @@ #include #include -#include - #include namespace nix { @@ -513,14 +511,6 @@ std::string_view printHashAlgo(HashAlgorithm ha) } } -void to_json(nlohmann::json & json, const Hash & hash) -{ - json = nlohmann::json::object({ - {"algo", printHashAlgo(hash.algo)}, - {"base16", hash.to_string(HashFormat::Base16, false)}, - }); -} - } // namespace nix namespace nlohmann { diff --git a/src/libutil/include/nix/util/hash.hh b/src/libutil/include/nix/util/hash.hh index 427d49a42b7..54b7051055f 100644 --- a/src/libutil/include/nix/util/hash.hh +++ b/src/libutil/include/nix/util/hash.hh @@ -7,8 +7,6 @@ #include "nix/util/file-system.hh" #include "nix/util/json-impls.hh" -#include - namespace nix { MakeError(BadHash, Error); @@ -216,11 +214,6 @@ parseHashAlgoOpt(std::string_view s, const ExperimentalFeatureSettings & xpSetti */ std::string_view printHashAlgo(HashAlgorithm ha); -/** - * Write a JSON serialisation of the format `{"algo":"","base16":""}`. - */ -void to_json(nlohmann::json & json, const Hash & hash); - struct AbstractHashSink : virtual Sink { virtual HashResult finish() = 0; diff --git a/src/libutil/include/nix/util/thread-pool.hh b/src/libutil/include/nix/util/thread-pool.hh index 6080ec6098a..63f1141f6a5 100644 --- a/src/libutil/include/nix/util/thread-pool.hh +++ b/src/libutil/include/nix/util/thread-pool.hh @@ -52,6 +52,12 @@ public: */ void process(); + /** + * Shut down all worker threads and wait until they've exited. + * Active work items are finished, but any pending work items are discarded. + */ + void shutdown(); + private: size_t maxThreads; @@ -72,8 +78,6 @@ private: std::condition_variable work; void doWork(bool mainThread); - - void shutdown(); }; /**