libstore: don’t include derivation names in build directories

They have variable size, which is bad for #913.

Change-Id: I6a6a6964a84804dee281ade48e6517419a6143fa
This commit is contained in:
Emily
2025-08-18 09:27:31 +00:00
committed by emilazy
parent 246f0eed82
commit ce6dcf18d6
2 changed files with 4 additions and 7 deletions
+2 -5
View File
@@ -446,8 +446,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
@@ -472,9 +471,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
+2 -2
View File
@@ -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