Browse Source

[runcoms/zprofile+zshenv] Ensure TMPDIR is always set

In some cases TMPDIR may not be set, in which case it could cause issues
for zsh modules.

This change was prompted by issue #1331.

Also when creating a missing TMPDIR, use mkdir --mode=700 instead
of creating the directory and then chmoding it afterward.
master
Samantha McVey 7 years ago committed by Kaleb Elwert
parent
commit
a4ff6acd56
  1. 10
      runcoms/zprofile
  2. 2
      runcoms/zshenv

10
runcoms/zprofile

@ -66,11 +66,11 @@ fi
# Temporary Files # Temporary Files
# #
# #
if [[ -z "$TMPDIR" ]]; then # Set TMPDIR if the variable is not set/empty or the directory doesn't exist
export TMPDIR="/tmp/zsh-$UID" if [[ -z "${TMPDIR}" ]]; then
export TMPDIR="/tmp/zsh-${UID}"
fi fi
if [[ ! -d "$TMPDIR" ]]; then if [[ ! -d "${TMPDIR}" ]]; then
mkdir "$TMPDIR" mkdir -m 700 "${TMPDIR}"
chmod 700 "$TMPDIR"
fi fi

2
runcoms/zshenv

@ -6,6 +6,6 @@
# #
# Ensure that a non-login, non-interactive shell has a defined environment. # Ensure that a non-login, non-interactive shell has a defined environment.
if [[ "$SHLVL" -eq 1 && ! -o LOGIN && -s "${ZDOTDIR:-$HOME}/.zprofile" ]]; then if [[ ( "$SHLVL" -eq 1 && ! -o LOGIN || -z "${TMPDIR}" ) && -s "${ZDOTDIR:-$HOME}/.zprofile" ]]; then
source "${ZDOTDIR:-$HOME}/.zprofile" source "${ZDOTDIR:-$HOME}/.zprofile"
fi fi

Loading…
Cancel
Save