Skip to content

Commit 491284b

Browse files
lberkicopybara-github
authored andcommitted
Do not do magic to achieve a hermetic /tmp when the sandbox is hermetic.
The sandbox process already does a `chroot()` and creates a fresh `/tmp` in it so no magic is needed. RELNOTES: None. PiperOrigin-RevId: 579782553 Change-Id: Ia5df1911ab326b739a0693ae81c794ecd8dce53d
1 parent 6935927 commit 491284b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/main/java/com/google/devtools/build/lib/sandbox/LinuxSandboxedSpawnRunner.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,12 @@ private boolean useHermeticTmp() {
187187
return false;
188188
}
189189

190+
if (getSandboxOptions().useHermetic) {
191+
// The hermetic sandbox is, well, already hermetic. Also, it creates an empty /tmp by default
192+
// so nothing needs to be done to achieve a /tmp that is also hermetic.
193+
return false;
194+
}
195+
190196
boolean tmpExplicitlyBindMounted =
191197
getSandboxOptions().sandboxAdditionalMounts.stream()
192198
.anyMatch(e -> e.getKey().equals("/tmp"));

0 commit comments

Comments
 (0)