aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google
diff options
context:
space:
mode:
authorGravatar Benjamin Peterson <bp@benjamin.pe>2017-07-19 13:21:07 +0200
committerGravatar Klaus Aehlig <aehlig@google.com>2017-07-19 16:48:42 +0200
commit10cc2e3e891ff643bb547e478f5b7e60a20ff658 (patch)
tree13d3911222b7ab046a46619c9c8fb6cbaee64b22 /src/main/java/com/google
parent891f540a1bc6977f25e77a29f24cdcf939fb2e2e (diff)
Fix sandboxing when spawn outputs differ from action outputs.
TestRunner actions are special because their action outputs are different from their spawn outputs. If there's a spawn output that's not an action output, SymlinkExecroot can't rely on the parent directories for that output existing in the real execroot. Thus, copyOutputs() must ensure the real execroot has the relevant ancestral directories before copying the output over. Change-Id: I84fd69cd51628c51de9c8993b6a4407bbff038a0 PiperOrigin-RevId: 162470058
Diffstat (limited to 'src/main/java/com/google')
-rw-r--r--src/main/java/com/google/devtools/build/lib/sandbox/SymlinkedSandboxedSpawn.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/sandbox/SymlinkedSandboxedSpawn.java b/src/main/java/com/google/devtools/build/lib/sandbox/SymlinkedSandboxedSpawn.java
index 96da98097e..defcf8a065 100644
--- a/src/main/java/com/google/devtools/build/lib/sandbox/SymlinkedSandboxedSpawn.java
+++ b/src/main/java/com/google/devtools/build/lib/sandbox/SymlinkedSandboxedSpawn.java
@@ -177,6 +177,10 @@ public class SymlinkedSandboxedSpawn implements SandboxedSpawn {
Path source = sandboxExecRoot.getRelative(output);
Path target = execRoot.getRelative(output);
if (source.isFile() || source.isSymbolicLink()) {
+ // Ensure the target directory exists in the real execroot. The directories for the action
+ // outputs have already been created, but the spawn outputs may be different from the
+ // overall action outputs. This is the case for test actions.
+ FileSystemUtils.createDirectoryAndParents(target.getParentDirectory());
Files.move(source.getPathFile(), target.getPathFile());
} else if (source.isDirectory()) {
try {