aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2023-02-01 16:46:26 +0100
committerRobert Hensing <robert@roberthensing.nl>2023-04-07 16:24:18 +0200
commita692c437298ad59004583f193ef3d73a378fd837 (patch)
treec6c9af6fcc5a859b0cf2db5d42b332072df6cbc3
parent6e0b7109abb40ded327b15599b29f861d9acb3c9 (diff)
Move loadConfFile() to initLibStore
Part of an effort to make it easier to initialize the right things, by moving code into the appropriate libraries. Using libstore without loading the config file is risky, as sqlite may then be misconfigured. See https://github.com/cachix/cachix/issues/475
-rw-r--r--perl/lib/Nix/Store.xs1
-rw-r--r--src/libmain/shared.cc2
-rw-r--r--src/libstore/globals.cc3
3 files changed, 3 insertions, 3 deletions
diff --git a/perl/lib/Nix/Store.xs b/perl/lib/Nix/Store.xs
index de91dc28d..b3f192810 100644
--- a/perl/lib/Nix/Store.xs
+++ b/perl/lib/Nix/Store.xs
@@ -27,7 +27,6 @@ static ref<Store> store()
if (!_store) {
try {
initLibStore();
- loadConfFile();
settings.lockCPU = false;
_store = openStore();
} catch (Error & e) {
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc
index 2ed310cba..6dd64c6c7 100644
--- a/src/libmain/shared.cc
+++ b/src/libmain/shared.cc
@@ -166,8 +166,6 @@ void initNix()
if (sodium_init() == -1)
throw Error("could not initialise libsodium");
- loadConfFile();
-
startSignalHandlerThread();
/* Reset SIGCHLD to its default. */
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc
index 823b4af74..b18525dd7 100644
--- a/src/libstore/globals.cc
+++ b/src/libstore/globals.cc
@@ -291,6 +291,9 @@ void assertLibStoreInitialized() {
}
void initLibStore() {
+
+ loadConfFile();
+
initLibStoreDone = true;
}