Skip to content

Sandbox scripts fixes#4561

Closed
AltGr wants to merge 6 commits intoocaml:masterfrom
OCamlPro:sandbox-arg
Closed

Sandbox scripts fixes#4561
AltGr wants to merge 6 commits intoocaml:masterfrom
OCamlPro:sandbox-arg

Conversation

@AltGr
Copy link
Copy Markdown
Member

@AltGr AltGr commented Feb 24, 2021

  • Linux sandbox (bwrap): change how TMPDIR is handled, because dune
    2.8 re-setting it was breaking the previous behaviour ; packages
    writing to /tmp instead of $TMPDIR will be broken though. See
    37ee01d for details.

  • Macos sandbox (sandbox_exec): port improvements made to bwrap in the
    past years while it was, it seems, forgotten.

The previous behaviour was to bind-mount $TMPDIR to /tmp within the sandbox, and
re-set TMPDIR accordingly ; however, this meant that absolute paths within
TMPDIR could be incompatible between the outside and the inside of the sandbox.

This became a visible problem with dune 2.8, which redefines TMPDIR to a
subdirectory (e.g. `/tmp/buildXXXX.dune`). If you happen to be running tests
with an OPAMROOT within $TMPDIR, your opam root will no longer be accessible,
and packages that run opam commands from within the sandbox (which is
discouraged, but well...) will break.

In our tests, run through dune, OPAMROOT gets created in
`/tmp/buildXXXX.dune/OPAM`, then packages get installed within a sandbox, this
is relocated to `/tmp/OPAM` but `OPAMROOT` and `OPAM_SWITCH_PREFIX` remained set
to below `/tmp/buildXXXX.dune`, and things broke.
this made PWD always rw accessible on remove actions, and was possibly dangerous
@AltGr AltGr added this to the 2.1.0 milestone Feb 26, 2021
@AltGr AltGr requested a review from rjbou March 4, 2021 13:27
@rjbou rjbou modified the milestones: 2.1.0, 2.1.0~rc Mar 4, 2021
@rjbou
Copy link
Copy Markdown
Collaborator

rjbou commented Mar 9, 2021

superseed by #4589

@rjbou rjbou closed this Mar 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants