Skip to content

Commit

Permalink
Fix bazelbuild#1063: When a temporary file was created in /etc while …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
philwo authored and damienmg committed Mar 21, 2016
1 parent 56d24a7 commit 1fe0e97
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -309,17 +309,13 @@ private MountMap mountUsualUnixDirs() throws IOException {
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<Path> 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("/")) {
Expand Down

0 comments on commit 1fe0e97

Please sign in to comment.