Skip to content

Commit 8edd688

Browse files
authored
Merge pull request #299 from DeterminateSystems/random-fixes
Random fixes
2 parents b9f2c51 + 98eab80 commit 8edd688

File tree

6 files changed

+14
-26
lines changed

6 files changed

+14
-26
lines changed

src/libexpr/eval-cache.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -381,11 +381,6 @@ AttrPath AttrCursor::getAttrPath(Symbol name) const
381381
return attrPath;
382382
}
383383

384-
std::string toAttrPathStr(EvalState & state, const AttrPath & attrPath)
385-
{
386-
return dropEmptyInitThenConcatStringsSep(".", state.symbols.resolve(attrPath));
387-
}
388-
389384
std::string AttrCursor::getAttrPathStr() const
390385
{
391386
return getAttrPath().to_string(root->state);

src/libfetchers/git-utils.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,7 @@ struct GitRepoImpl : GitRepo, std::enable_shared_from_this<GitRepoImpl>
709709
keyDecoded = base64::decode(k.key);
710710
} catch (Error & e) {
711711
e.addTrace({}, "while decoding public key '%s' used for git signature", k.key);
712+
throw;
712713
}
713714
auto fingerprint =
714715
trim(hashString(HashAlgorithm::SHA256, keyDecoded).to_string(nix::HashFormat::Base64, false), "=");
@@ -1121,6 +1122,13 @@ struct GitFileSystemObjectSinkImpl : GitFileSystemObjectSink
11211122
{
11221123
}
11231124

1125+
~GitFileSystemObjectSinkImpl()
1126+
{
1127+
// Make sure the worker threads are destroyed before any state
1128+
// they're referring to.
1129+
workers.shutdown();
1130+
}
1131+
11241132
struct Child;
11251133

11261134
/// A directory to be written as a Git tree.

src/libstore/build-result.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
#include "nix/util/json-utils.hh"
33
#include <array>
44

5-
#include <nlohmann/json.hpp>
6-
75
namespace nix {
86

97
bool BuildResult::operator==(const BuildResult &) const noexcept = default;

src/libutil/hash.cc

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
#include <sys/stat.h>
2020
#include <fcntl.h>
2121

22-
#include <nlohmann/json.hpp>
23-
2422
#include <sodium.h>
2523

2624
namespace nix {
@@ -513,14 +511,6 @@ std::string_view printHashAlgo(HashAlgorithm ha)
513511
}
514512
}
515513

516-
void to_json(nlohmann::json & json, const Hash & hash)
517-
{
518-
json = nlohmann::json::object({
519-
{"algo", printHashAlgo(hash.algo)},
520-
{"base16", hash.to_string(HashFormat::Base16, false)},
521-
});
522-
}
523-
524514
} // namespace nix
525515

526516
namespace nlohmann {

src/libutil/include/nix/util/hash.hh

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
#include "nix/util/file-system.hh"
88
#include "nix/util/json-impls.hh"
99

10-
#include <nlohmann/json_fwd.hpp>
11-
1210
namespace nix {
1311

1412
MakeError(BadHash, Error);
@@ -216,11 +214,6 @@ parseHashAlgoOpt(std::string_view s, const ExperimentalFeatureSettings & xpSetti
216214
*/
217215
std::string_view printHashAlgo(HashAlgorithm ha);
218216

219-
/**
220-
* Write a JSON serialisation of the format `{"algo":"<sha1|...>","base16":"<hex>"}`.
221-
*/
222-
void to_json(nlohmann::json & json, const Hash & hash);
223-
224217
struct AbstractHashSink : virtual Sink
225218
{
226219
virtual HashResult finish() = 0;

src/libutil/include/nix/util/thread-pool.hh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ public:
5252
*/
5353
void process();
5454

55+
/**
56+
* Shut down all worker threads and wait until they've exited.
57+
* Active work items are finished, but any pending work items are discarded.
58+
*/
59+
void shutdown();
60+
5561
private:
5662

5763
size_t maxThreads;
@@ -72,8 +78,6 @@ private:
7278
std::condition_variable work;
7379

7480
void doWork(bool mainThread);
75-
76-
void shutdown();
7781
};
7882

7983
/**

0 commit comments

Comments
 (0)