libstore: don’t include derivation names in build directories

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

Change-Id: I6a6a6964870e984c66277c7556ff3c2bc34ddca1
This commit is contained in:
Emily
2025-11-14 14:58:15 +01:00
committed by Qyriad
parent 1102cc180a
commit 13a37f1246
2 changed files with 4 additions and 7 deletions
+2 -5
View File
@@ -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
+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