Skip to content

Commit

Permalink
Merge pull request #5780 from ElectreAAS/sandbox-shellfix
Browse files Browse the repository at this point in the history
Fix macos sandbox script incorrectly assuming that `getconf` doesn't exist
  • Loading branch information
dra27 authored Jan 22, 2024
2 parents f6677d2 + a0960d0 commit 285bf78
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ users)
## Format upgrade

## Sandbox
* Mark the user temporary directory (as returned by `getconf DARWIN_USER_TEMP_DIR`) as writable when TMPDIR is not defined on macOS [#5780 @ElectreAAS]

## VCS

Expand Down
6 changes: 3 additions & 3 deletions src/state/shellscripts/sandbox_exec.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# This script is only used on macOS, where /bin/bash is both guaranteed to exist and
# This script is only used on macOS, where /bin/bash is both guaranteed to exist
# and to be for the native architecture, which is why /usr/bin/env bash is not used.
# See https://github.com/ocaml/opam/issues/5450
set -ue
Expand All @@ -20,10 +20,10 @@ add_mounts() {
}

if [ -z ${TMPDIR+x} ]; then
# Others applications obtain the per-user temporary
# Other applications obtain the per-user temporary
# directory differently; the latter should be made readable/writable
# too and getconf seems to be a robust way to get it
if [ -z /usr/bin/getconf ]; then
if command -v getconf > /dev/null ; then
TMPDIR=$(getconf DARWIN_USER_TEMP_DIR)
add_mounts rw "$TMPDIR"
export TMPDIR
Expand Down

0 comments on commit 285bf78

Please sign in to comment.