From 805aeffece019eec34a95bc2465995493ecd0eed Mon Sep 17 00:00:00 2001 From: Raito Bezarius Date: Thu, 21 Aug 2025 14:36:10 +0000 Subject: [PATCH] Revert "libstore: simplify fallback build directory logic" Revert submission 3850 Reason for revert: caused multiple regressions noticed in https://git.lix.systems/lix-project/lix/issues/975 and https://git.lix.systems/lix-project/lix/issues/966 (suspected). Root cause analysis has not been done yet and this breaks Lix on Darwin on HEAD. Reverted changes: /q/submissionid:3850 Change-Id: Id6db066f3f5c454b258157bc12e0f26020de94a7 --- lix/libstore/build/local-derivation-goal.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lix/libstore/build/local-derivation-goal.cc b/lix/libstore/build/local-derivation-goal.cc index a0adb1541..0fc2deb3a 100644 --- a/lix/libstore/build/local-derivation-goal.cc +++ b/lix/libstore/build/local-derivation-goal.cc @@ -457,6 +457,8 @@ try { throw; } + auto globalTmp = defaultTempDir(); + createDirs(globalTmp); #if __APPLE__ /* macOS filesystem namespacing does not exist, to avoid breaking builds, we need to weaken * the mode bits on the top-level directory. This avoids issues like @@ -466,7 +468,7 @@ try { constexpr int toplevelDirMode = 0700; #endif auto nixBuildsTmp = createTempDir( - "", fmt("nix-builds-%s", geteuid()), false, false, toplevelDirMode + globalTmp, fmt("nix-builds-%s", geteuid()), false, false, toplevelDirMode ); warn( "Failed to use the system-wide build directory '%s', falling back to a temporary " @@ -474,10 +476,10 @@ try { settings.buildDir.get(), nixBuildsTmp ); + worker.buildDirOverride = nixBuildsTmp; tmpDirRoot = createTempDir( nixBuildsTmp, "nix-build-" + std::string(drvPath.name()), false, false, 0700 ); - worker.buildDirOverride = nixBuildsTmp; } /* The TOCTOU between the previous mkdir call and this open call is unavoidable due to * POSIX semantics.*/