From d15b99f4895f12af49a6b589f8af445446bc9740 Mon Sep 17 00:00:00 2001 From: Qyriad Date: Fri, 31 Oct 2025 14:30:50 +0100 Subject: [PATCH] libstore/static-init: don't crash if nixBinDir exists but isn't accessible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In d2696cdd¹, libstore was made to prioritize NIX_BIN_DIR/nix (over /proc/self/exe) if it exists. But `pathExists()` throws an exception if lstat() returns any error other than non-existence. Because this check happens in libstore's Settings constructor for the static-initialized global `nix::Settings`, this case would abort Lix well before main(). [1]: d2696cdd1ee404ef6c6bd532cb90007dd8ee3e9f Change-Id: I62e44c8a33b28c234900df3e4790c1badefee358 --- lix/libstore/globals.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lix/libstore/globals.cc b/lix/libstore/globals.cc index e1a4dd9a9..048feaee2 100644 --- a/lix/libstore/globals.cc +++ b/lix/libstore/globals.cc @@ -116,7 +116,7 @@ Settings::Settings() you'll want to improve `getSelfExe()` to work on your platform. */ std::string nixExePath = nixBinDir + "/nix"; - if (!pathExists(nixExePath)) { + if (!pathAccessible(nixExePath)) { nixExePath = getSelfExe().value_or("nix"); } buildHook.setDefault(Strings {