Skip to content

Commit

Permalink
Do not do magic to achieve a hermetic /tmp when the sandbox is herm…
Browse files Browse the repository at this point in the history
…etic.

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
  • Loading branch information
lberki authored and copybara-github committed Nov 6, 2023
1 parent 6935927 commit 491284b
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@ private boolean useHermeticTmp() {
return false;
}

if (getSandboxOptions().useHermetic) {
// The hermetic sandbox is, well, already hermetic. Also, it creates an empty /tmp by default
// so nothing needs to be done to achieve a /tmp that is also hermetic.
return false;
}

boolean tmpExplicitlyBindMounted =
getSandboxOptions().sandboxAdditionalMounts.stream()
.anyMatch(e -> e.getKey().equals("/tmp"));
Expand Down

0 comments on commit 491284b

Please sign in to comment.