From 005b2b61e671e11d0427507883f8ae66e15d939d Mon Sep 17 00:00:00 2001 From: Qyriad Date: Mon, 6 May 2024 20:54:21 -0600 Subject: [PATCH] fix fallback chroot store creation after b247ef72d When /nix/var (or, more precisely, NIX_STATE_DIR) does not exist at all, Lix falls back to creating an adhoc chroot store in XDG_DATA_HOME. b247ef72d[1] changed the way Store classes are initialized, and in the migration, a `params2` was accidentally changed to `params`. This commit restores the correct behavior, and in lieu of a single *character* fix, this commit also changes the variable name to something more reasonable. Fixes #274. [1]: b247ef72dc7bcc857288c0ddcceb3e42f76a78f1 n.b., this code might deserve some more looking at anyway. this fallback store creation throws away *all* Store params passed to openFromNonUri() in favor of an entirely new set which only contains the `root` param, which may or may not be the correct behavior Change-Id: Ibea559b88a50e6d6e75a1f87d9d7816cabb2a8f3 --- src/libstore/store-api.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index 8c9940c86..f696e4c1f 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -1444,9 +1444,10 @@ std::shared_ptr openFromNonUri(const std::string & uri, const Store::Para warn("'%s' does not exist, so Nix will use '%s' as a chroot store", stateDir, chrootStore); } else debug("'%s' does not exist, so Nix will use '%s' as a chroot store", stateDir, chrootStore); - Store::Params params2; - params2["root"] = chrootStore; - return LocalStore::makeLocalStore(params); + Store::Params chrootStoreParams; + chrootStoreParams["root"] = chrootStore; + // FIXME? this ignores *all* store parameters passed to this function? + return LocalStore::makeLocalStore(chrootStoreParams); } #endif else