-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This change makes it possible to use the Linux sandbox when either th…
…e execroot, some package path entries, or both are under /tmp. This is achieved by a reshuffling of the sandbox directory layout in the following way: * The exec root base is `/tmp/bazel-working-directory` (cwd is under it) * Source roots are mapped under `/tmp/bazel-source-roots/$NUMBER` * The "real" exec root is mapped to `/tmp/bazel-execroot`. * All this is achieved with subtle manipulation of bind mounts: 1. The real exec root (bazel info execution_root) under `$SANDBOX/_tmp/bazel-execroot` 2. The sandbox exec root (the symlink tree the sandbox creates) under `$SANDBOX/_tmp/bazel-working-directory` 3. Each source root under `$SANDBOX/_tmp/bazel-source-roots/$NUMBER` 4. `$SANDBOX/_tmp` under `/tmp` This makes the directories in (1), (2) and (3) available as `/tmp/$NAME` even if they were originally under `/tmp` (which gets clobbered in step (4)) The functionality is gated under `--incompatible_sandbox_hermetic_tmp` since it requires `/tmp` to be in a known state, which only that flag can guarantee. Notably, putting these three directories under `/` does not work, because the non-hermetic sandbox uses the real file system and the root directory is not writable. We could conceivably get around that by bind mounting every first child of the "real" root directory in the sandbox root directory and using a writable directory as the sandbox root, but why bother if this one works. Progress towards #3236 (the flag still needs to be flipped) RELNOTES: None. PiperOrigin-RevId: 494650851 Change-Id: I0b3d1baf748a357a5bb4dee799cf807c2d75ef15
- Loading branch information
1 parent
0a2c4ed
commit 8e32f44
Showing
12 changed files
with
338 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.