File tree Expand file tree Collapse file tree 4 files changed +14
-8
lines changed Expand file tree Collapse file tree 4 files changed +14
-8
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ synopsis : " Temporary build directories no longer include derivation names"
3
+ prs : [13839]
4
+ ---
5
+
6
+ Temporary build directories created during derivation builds no longer include the derivation name in their path to avoid build failures when the derivation name is too long. This change ensures predictable prefix lengths for build directories under ` /nix/var/nix/builds ` .
Original file line number Diff line number Diff line change @@ -717,7 +717,7 @@ void DerivationBuilderImpl::startBuilder()
717
717
718
718
/* Create a temporary directory where the build will take
719
719
place. */
720
- topTmpDir = createTempDir (buildDir, " nix-build- " + std::string (drvPath. name ()) , 0700 );
720
+ topTmpDir = createTempDir (buildDir, " nix" , 0700 );
721
721
setBuildTmpDir ();
722
722
assert (!tmpDir.empty ());
723
723
Original file line number Diff line number Diff line change @@ -52,10 +52,10 @@ test_custom_build_dir() {
52
52
nix-build check.nix -A failed --argstr checkBuildId " $checkBuildId " \
53
53
--no-out-link --keep-failed --option build-dir " $TEST_ROOT /custom-build-dir" 2> " $TEST_ROOT /log" || status=$?
54
54
[ " $status " = " 100" ]
55
- [[ 1 == " $( count " $customBuildDir /nix-build- " * ) " ]]
56
- local buildDir=(" $customBuildDir /nix-build- " * )
55
+ [[ 1 == " $( count " $customBuildDir /nix-" * ) " ]]
56
+ local buildDir=(" $customBuildDir /nix-" * )
57
57
if [[ " ${# buildDir[@]} " -ne 1 ]]; then
58
- echo " expected one nix-build- * directory, got: ${buildDir[*]} " >&2
58
+ echo " expected one nix-* directory, got: ${buildDir[*]} " >&2
59
59
exit 1
60
60
fi
61
61
if [[ -e ${buildDir[*]} /build ]]; then
Original file line number Diff line number Diff line change 104
104
105
105
# Wait for the build to be ready
106
106
# This is OK because it runs as root, so we can access everything
107
- machine.wait_until_succeeds("stat /nix/var/nix/builds/nix-build-open-build-dir.drv- */build/syncPoint")
108
- dir = machine.succeed("ls -d /nix/var/nix/builds/nix-build-open-build-dir.drv- *").strip()
107
+ machine.wait_until_succeeds("stat /nix/var/nix/builds/nix-*/build/syncPoint")
108
+ dir = machine.succeed("ls -d /nix/var/nix/builds/nix-*").strip()
109
109
110
110
# But Alice shouldn't be able to access the build directory
111
111
machine.fail(f"su alice -c 'ls {dir}/build'")
125
125
args = [ (builtins.storePath "${ create-hello-world } ") ];
126
126
}' >&2 &
127
127
""".strip())
128
- machine.wait_until_succeeds("stat /nix/var/nix/builds/nix-build-innocent.drv- */build/syncPoint")
129
- dir = machine.succeed("ls -d /nix/var/nix/builds/nix-build-innocent.drv- *").strip()
128
+ machine.wait_until_succeeds("stat /nix/var/nix/builds/nix-*/build/syncPoint")
129
+ dir = machine.succeed("ls -d /nix/var/nix/builds/nix-*").strip()
130
130
131
131
# The build ran as `nixbld1` (which is the only build user on the
132
132
# machine), but a process running as `nixbld1` outside the sandbox
You can’t perform that action at this time.
0 commit comments