From 13a37f12467f1d5a2ef278a141dbfaa878c2dde7 Mon Sep 17 00:00:00 2001 From: Emily Date: Sun, 3 Aug 2025 19:06:02 +0100 Subject: [PATCH] =?UTF-8?q?libstore:=20don=E2=80=99t=20include=20derivatio?= =?UTF-8?q?n=20names=20in=20build=20directories?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit They have variable size, which is bad for #913. Change-Id: I6a6a6964870e984c66277c7556ff3c2bc34ddca1 --- lix/libstore/build/local-derivation-goal.cc | 7 ++----- tests/functional/check.sh | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lix/libstore/build/local-derivation-goal.cc b/lix/libstore/build/local-derivation-goal.cc index e82e93ebd..eda71b410 100644 --- a/lix/libstore/build/local-derivation-goal.cc +++ b/lix/libstore/build/local-derivation-goal.cc @@ -456,8 +456,7 @@ try { /* Create a temporary directory where the build will take place. */ - tmpDirRoot = - createTempSubdir(buildDir, "nix-build-" + std::string(drvPath.name()), 0700); + tmpDirRoot = createTempSubdir(buildDir, std::nullopt, 0700); } catch (SysError & e) { /* * Fallback to the global tmpdir and create a safe space there @@ -482,9 +481,7 @@ try { settings.buildDir.get(), nixBuildsTmp ); - tmpDirRoot = createTempSubdir( - nixBuildsTmp, "nix-build-" + std::string(drvPath.name()), 0700 - ); + tmpDirRoot = createTempSubdir(nixBuildsTmp, std::nullopt, 0700); worker.buildDirOverride = nixBuildsTmp; } /* The TOCTOU between the previous mkdir call and this open call is unavoidable due to diff --git a/tests/functional/check.sh b/tests/functional/check.sh index 87fb5e245..671ec2761 100644 --- a/tests/functional/check.sh +++ b/tests/functional/check.sh @@ -40,8 +40,8 @@ test_custom_build_dir() { nix-build check.nix -A failed --argstr checkBuildId $checkBuildId \ --no-out-link --keep-failed --option build-dir "$TEST_ROOT/custom-build-dir" 2> $TEST_ROOT/log || status=$? [ "$status" = "100" ] - [[ 1 == "$(count "$customBuildDir/nix-build-"*)" ]] - local buildDir="$customBuildDir/nix-build-"* + [[ 1 == "$(count "$customBuildDir/"*)" ]] + local buildDir="$customBuildDir/"* grep $checkBuildId $buildDir/b/checkBuildId } test_custom_build_dir