diff options
Diffstat (limited to 'src/main/java/com/google/devtools')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/sandbox/DarwinSandboxRunner.java | 13 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/sandbox/SandboxStrategy.java | 6 |
2 files changed, 8 insertions, 11 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/sandbox/DarwinSandboxRunner.java b/src/main/java/com/google/devtools/build/lib/sandbox/DarwinSandboxRunner.java index 4a2fc4265d..6e6714befb 100644 --- a/src/main/java/com/google/devtools/build/lib/sandbox/DarwinSandboxRunner.java +++ b/src/main/java/com/google/devtools/build/lib/sandbox/DarwinSandboxRunner.java @@ -42,7 +42,7 @@ final class DarwinSandboxRunner extends SandboxRunner { private static final String SANDBOX_EXEC = "/usr/bin/sandbox-exec"; private final Path sandboxExecRoot; - private final Path argumentsFilePath; + private final Path sandboxConfigPath; private final Set<Path> writableDirs; private final Path runUnderPath; @@ -54,7 +54,7 @@ final class DarwinSandboxRunner extends SandboxRunner { boolean verboseFailures) { super(verboseFailures); this.sandboxExecRoot = sandboxExecRoot; - this.argumentsFilePath = sandboxPath.getRelative("sandbox.sb"); + this.sandboxConfigPath = sandboxPath.getRelative("sandbox.sb"); this.writableDirs = writableDirs; this.runUnderPath = runUnderPath; } @@ -105,7 +105,7 @@ final class DarwinSandboxRunner extends SandboxRunner { @Override protected Command getCommand( List<String> arguments, - Map<String, String> environment, + Map<String, String> env, int timeout, boolean allowNetwork, boolean useFakeHostname, @@ -116,17 +116,16 @@ final class DarwinSandboxRunner extends SandboxRunner { List<String> commandLineArgs = new ArrayList<>(); commandLineArgs.add(SANDBOX_EXEC); commandLineArgs.add("-f"); - commandLineArgs.add(argumentsFilePath.getPathString()); + commandLineArgs.add(sandboxConfigPath.getPathString()); commandLineArgs.addAll(arguments); - return new Command( - commandLineArgs.toArray(new String[0]), environment, sandboxExecRoot.getPathFile()); + return new Command(commandLineArgs.toArray(new String[0]), env, sandboxExecRoot.getPathFile()); } private void writeConfig(boolean allowNetwork) throws IOException { try (PrintWriter out = new PrintWriter( new BufferedWriter( - new OutputStreamWriter(argumentsFilePath.getOutputStream(), UTF_8)))) { + new OutputStreamWriter(sandboxConfigPath.getOutputStream(), UTF_8)))) { // Note: In Apple's sandbox configuration language, the *last* matching rule wins. out.println("(version 1)"); out.println("(debug deny)"); diff --git a/src/main/java/com/google/devtools/build/lib/sandbox/SandboxStrategy.java b/src/main/java/com/google/devtools/build/lib/sandbox/SandboxStrategy.java index 7f477f02c0..e7cd425229 100644 --- a/src/main/java/com/google/devtools/build/lib/sandbox/SandboxStrategy.java +++ b/src/main/java/com/google/devtools/build/lib/sandbox/SandboxStrategy.java @@ -15,7 +15,6 @@ package com.google.devtools.build.lib.sandbox; import com.google.common.collect.ImmutableSet; -import com.google.common.collect.ImmutableSet.Builder; import com.google.common.eventbus.EventBus; import com.google.devtools.build.lib.actions.ActionExecutionContext; import com.google.devtools.build.lib.actions.ActionExecutionMetadata; @@ -184,12 +183,11 @@ abstract class SandboxStrategy implements SandboxedSpawnActionContext { */ protected ImmutableSet<Path> getWritableDirs(Path sandboxExecRoot, Map<String, String> env) throws IOException { - Builder<Path> writableDirs = ImmutableSet.builder(); // We have to make the TEST_TMPDIR directory writable if it is specified. if (env.containsKey("TEST_TMPDIR")) { - writableDirs.add(sandboxExecRoot.getRelative(env.get("TEST_TMPDIR"))); + return ImmutableSet.of(sandboxExecRoot.getRelative(env.get("TEST_TMPDIR"))); } - return writableDirs.build(); + return ImmutableSet.of(); } @Override |