Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sandboxing on MacOS: considering the possibility that TMPDIR in unset #3597

Merged
merged 1 commit into from
Oct 17, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/state/shellscripts/sandbox_exec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,20 @@ add_mounts() {
esac
}

add_mounts rw "${TMPDIR:-/tmp}"
if [ -z ${TMPDIR+x} ]; then
# If $TMPDIR is not set, some applications use /tmp, so
# /tmp must be made readable/writable
add_mounts rw /tmp
# However, others 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
TMP=`getconf DARWIN_USER_TEMP_DIR`
add_mounts rw $TMP
fi
else
add_mounts rw $TMPDIR
fi

# C compilers using `ccache` will write to a shared cache directory
# that remain writeable. ccache seems widespread in some Fedora systems.
Expand Down