diff options
author | 2015-08-28 14:45:44 +0000 | |
---|---|---|
committer | 2015-08-28 15:00:52 +0000 | |
commit | 601be74a64585172bd487caa267623bf7b00253c (patch) | |
tree | e7692b65a8adaae26a7bd77b5f86da4a2e69b738 /src/main | |
parent | 72545d5d5cf1d59254f64b13688175e0f301e324 (diff) |
Fixes #400: Linux sandboxing and relative symbolic links.
Symlink resolution did not work in all cases and broke ./compile.sh on certain Linux distros.
--
MOS_MIGRATED_REVID=101775459
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/sandbox/LinuxSandboxedStrategy.java | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/sandbox/LinuxSandboxedStrategy.java b/src/main/java/com/google/devtools/build/lib/sandbox/LinuxSandboxedStrategy.java index 26a5650048..6cd142c59b 100644 --- a/src/main/java/com/google/devtools/build/lib/sandbox/LinuxSandboxedStrategy.java +++ b/src/main/java/com/google/devtools/build/lib/sandbox/LinuxSandboxedStrategy.java @@ -51,11 +51,9 @@ import com.google.devtools.build.lib.vfs.SearchPath; import java.io.File; import java.io.IOException; import java.nio.charset.Charset; -import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.Set; import java.util.UUID; import java.util.concurrent.ExecutorService; import java.util.concurrent.atomic.AtomicInteger; @@ -205,15 +203,9 @@ public class LinuxSandboxedStrategy implements SpawnActionContext { Path target = mount.getValue(); validateAndAddMount(sandboxPath, fixedMounts, source, target); - // Iteratively resolve symlinks and mount the whole chain. Take care not to run into a cyclic - // symlink - when we already processed the source once, we can exit the loop. Skyframe will - // catch cyclic symlinks for declared inputs, but this won't help if there is one in the parts - // of the host system that we mount. - Set<Path> seenSources = new HashSet<>(); - while (source.isSymbolicLink() && seenSources.add(source)) { - source = source.getParentDirectory().getRelative(source.readSymbolicLink()); + if (source.isSymbolicLink()) { + source = source.resolveSymbolicLinks(); target = sandboxPath.getRelative(source.asFragment().relativeTo("/")); - validateAndAddMount(sandboxPath, fixedMounts, source, target); } } |