call SetupDirectories after uids are mapped in the user namespace
fixes #1637 (https://github.com/bazelbuild/bazel/issues/1637)
--
Change-Id: I8b8c3596fd2a4c125071406eefd407ca402099dd
Reviewed-on: https://bazel-review.git.corp.google.com/#/c/5410/2
MOS_MIGRATED_REVID=130633667
diff --git a/src/main/tools/linux-sandbox.c b/src/main/tools/linux-sandbox.c
index 580225d..23bd024 100644
--- a/src/main/tools/linux-sandbox.c
+++ b/src/main/tools/linux-sandbox.c
@@ -795,14 +795,14 @@
// outside environment.
CHECK_CALL(mount("none", "/", NULL, MS_REC | MS_PRIVATE, NULL));
- SetupDirectories();
-
if (opt.fake_root) {
SetupUserNamespace(uid, gid, 0, 0);
} else {
SetupUserNamespaceForNobody(uid, gid);
}
+ SetupDirectories();
+
ChangeRoot();
SpawnCommand(opt.args, opt.timeout_secs, false);