Skip to content

Commit

Permalink
Fix macos sandbox script incorrectly assuming that getconf doesn't …
Browse files Browse the repository at this point in the history
…exist
  • Loading branch information
ElectreAAS authored and kit-ty-kate committed Jan 12, 2024
1 parent 265fbcb commit a0960d0
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 @@ -67,6 +67,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 a0960d0

Please sign in to comment.