From 1fe0e97f337956a208957be69e97d710870203e1 Mon Sep 17 00:00:00 2001 From: Philipp Wollermann Date: Mon, 21 Mar 2016 17:17:52 +0000 Subject: Fix #1063: When a temporary file was created in /etc while we were globbing the list of files to mount, but was deleted by the time the namespace-sandbox actually mounted the files, it would crash with a "file not found" error. -- MOS_MIGRATED_REVID=117726198 --- .../google/devtools/build/lib/sandbox/LinuxSandboxedStrategy.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/main/java/com/google/devtools/build/lib') 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 69ed5666a7..ce775591b5 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 @@ -309,17 +309,13 @@ public class LinuxSandboxedStrategy implements SpawnActionContext { FileSystem fs = blazeDirs.getFileSystem(); mounts.put(fs.getPath("/bin"), fs.getPath("/bin")); mounts.put(fs.getPath("/sbin"), fs.getPath("/sbin")); + mounts.put(fs.getPath("/etc"), fs.getPath("/etc")); // Check if /etc/resolv.conf is a symlink and mount its target // Fix #738 Path resolv = fs.getPath("/etc/resolv.conf"); if (resolv.exists() && resolv.isSymbolicLink()) { - mounts.put(resolv, resolv.resolveSymbolicLinks()); - - List resolvList = ImmutableList.of(resolv); - mounts.putAll(mountDirExclude(fs.getPath("/etc"), resolvList)); - } else { - mounts.put(fs.getPath("/etc"), fs.getPath("/etc")); + mounts.put(resolv.resolveSymbolicLinks(), resolv.resolveSymbolicLinks()); } for (String entry : NativePosixFiles.readdir("/")) { -- cgit v1.2.3