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()
717717
718718 /* Create a temporary directory where the build will take
719719 place. */
720- topTmpDir = createTempDir (buildDir, " nix-build- " + std::string (drvPath. name ()) , 0700 );
720+ topTmpDir = createTempDir (buildDir, " nix" , 0700 );
721721 setBuildTmpDir ();
722722 assert (!tmpDir.empty ());
723723
Original file line number Diff line number Diff line change @@ -52,10 +52,10 @@ test_custom_build_dir() {
5252 nix-build check.nix -A failed --argstr checkBuildId " $checkBuildId " \
5353 --no-out-link --keep-failed --option build-dir " $TEST_ROOT /custom-build-dir" 2> " $TEST_ROOT /log" || status=$?
5454 [ " $status " = " 100" ]
55- [[ 1 == " $( count " $customBuildDir /nix-build- " * ) " ]]
56- local buildDir=(" $customBuildDir /nix-build- " * )
55+ [[ 1 == " $( count " $customBuildDir /nix-" * ) " ]]
56+ local buildDir=(" $customBuildDir /nix-" * )
5757 if [[ " ${# buildDir[@]} " -ne 1 ]]; then
58- echo " expected one nix-build- * directory, got: ${buildDir[*]} " >&2
58+ echo " expected one nix-* directory, got: ${buildDir[*]} " >&2
5959 exit 1
6060 fi
6161 if [[ -e ${buildDir[*]} /build ]]; then
Original file line number Diff line number Diff line change 104104
105105 # Wait for the build to be ready
106106 # 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()
109109
110110 # But Alice shouldn't be able to access the build directory
111111 machine.fail(f"su alice -c 'ls {dir}/build'")
125125 args = [ (builtins.storePath "${ create-hello-world } ") ];
126126 }' >&2 &
127127 """.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()
130130
131131 # The build ran as `nixbld1` (which is the only build user on the
132132 # machine), but a process running as `nixbld1` outside the sandbox
You can’t perform that action at this time.
0 commit comments