mirror of
https://github.com/NixOS/nix.git
synced 2025-11-19 16:59:35 +01:00
Fix --no-sandbox
When sandboxing is disabled, we cannot put $TMPDIR underneath an
inaccessible directory.
(cherry picked from commit d54590fdf3)
This commit is contained in:
parent
71af23ff18
commit
07b9fae361
2 changed files with 12 additions and 4 deletions
|
|
@ -503,9 +503,14 @@ void LocalDerivationGoal::startBuilder()
|
|||
|
||||
/* Create a temporary directory where the build will take
|
||||
place. */
|
||||
auto parentTmpDir = createTempDir(settings.buildDir.get().value_or(""), "nix-build-" + std::string(drvPath.name()), false, false, 0700);
|
||||
tmpDir = parentTmpDir + "/build";
|
||||
createDir(tmpDir, 0700);
|
||||
tmpDir = createTempDir(settings.buildDir.get().value_or(""), "nix-build-" + std::string(drvPath.name()), false, false, 0700);
|
||||
if (useChroot) {
|
||||
/* If sandboxing is enabled, put the actual TMPDIR underneath
|
||||
an inaccessible root-owned directory, to prevent outside
|
||||
access. */
|
||||
tmpDir = tmpDir + "/build";
|
||||
createDir(tmpDir, 0700);
|
||||
}
|
||||
chownToBuilder(tmpDir);
|
||||
|
||||
for (auto & [outputName, status] : initialOutputs) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue