Skip to content

Commit

Permalink
Reduce diff
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum committed May 8, 2024
1 parent 5e6c1f6 commit 21fcad5
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.google.devtools.build.lib.vfs.FileSystemUtils;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.lib.vfs.RootedPath;
import java.io.IOException;
import java.util.LinkedHashSet;
import java.util.Set;
Expand Down Expand Up @@ -162,9 +163,9 @@ void createInputs(Iterable<PathFragment> inputsToCreate, SandboxInputs inputs)
}
Path key = sandboxExecRoot.getRelative(fragment);
if (inputs.getFiles().containsKey(fragment)) {
Path fileDest = inputs.getFiles().get(fragment).asPath();
RootedPath fileDest = inputs.getFiles().get(fragment);
if (fileDest != null) {
copyFile(fileDest, key);
copyFile(fileDest.asPath(), key);
} else {
FileSystemUtils.createEmptyFile(key);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ protected ImmutableSet<Path> getWritableDirs(
// On Windows, sandboxExecRoot is actually the main execroot. We will specify
// exactly which output path is writable.
if (OS.getCurrent() != OS.WINDOWS) {
writablePaths.add(execRoot);
writablePaths.add(sandboxExecRoot);
}

String testTmpdir = env.get("TEST_TMPDIR");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ private static boolean computeIsSupported(CommandEnvironment cmdEnv, Path linuxS
}

private final SandboxHelpers helpers;
private final FileSystem fileSystem;
private final Path execRoot;
private final boolean allowNetwork;
private final Path linuxSandbox;
Expand All @@ -136,7 +137,6 @@ private static boolean computeIsSupported(CommandEnvironment cmdEnv, Path linuxS
private final Duration timeoutKillDelay;
private final TreeDeleter treeDeleter;
private final Reporter reporter;
private final FileSystem fileSystem;
private final Path slashTmp;
private final Path outputBase;
private final LoadingCache<Root, ImmutableSet<Path>> symlinkChainCache =
Expand All @@ -163,6 +163,7 @@ private static boolean computeIsSupported(CommandEnvironment cmdEnv, Path linuxS
TreeDeleter treeDeleter) {
super(cmdEnv);
this.helpers = helpers;
this.fileSystem = cmdEnv.getRuntime().getFileSystem();
this.execRoot = cmdEnv.getExecRoot();
this.allowNetwork = helpers.shouldAllowNetwork(cmdEnv.getOptions());
this.linuxSandbox = LinuxSandboxUtil.getLinuxSandbox(cmdEnv.getBlazeWorkspace());
Expand All @@ -173,7 +174,6 @@ private static boolean computeIsSupported(CommandEnvironment cmdEnv, Path linuxS
this.localEnvProvider = new PosixLocalEnvProvider(cmdEnv.getClientEnv());
this.treeDeleter = treeDeleter;
this.reporter = cmdEnv.getReporter();
this.fileSystem = cmdEnv.getRuntime().getFileSystem();
this.slashTmp = cmdEnv.getRuntime().getFileSystem().getPath("/tmp");
this.outputBase = cmdEnv.getOutputBase();
}
Expand Down Expand Up @@ -215,7 +215,6 @@ protected SandboxedSpawn prepareSpawn(Spawn spawn, SpawnExecutionContext context
// so we have to prefix our name to turn it into a globally unique value.
Path sandboxPath =
sandboxBase.getRelative(getName()).getRelative(Integer.toString(context.getId()));
sandboxPath.createDirectoryAndParents();

// b/64689608: The execroot of the sandboxed process must end with the workspace name, just like
// the normal execroot does.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.lib.vfs.RootedPath;

import java.io.IOException;
import java.util.LinkedHashSet;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,7 @@
import com.google.devtools.build.lib.vfs.FileSystemUtils;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.lib.vfs.Root;
import com.google.devtools.build.lib.vfs.RootedPath;
import com.google.devtools.build.lib.vfs.Root;
import com.google.devtools.build.lib.vfs.XattrProvider;
import com.google.devtools.build.lib.vfs.XattrProvider;
import com.google.devtools.build.lib.worker.WorkerProtocol.WorkRequest;
import com.google.devtools.build.lib.worker.WorkerProtocol.WorkResponse;
import com.google.protobuf.ByteString;
Expand Down

0 comments on commit 21fcad5

Please sign in to comment.