Default environment filtering to on for all users.

This commit is contained in:
Mike McQuaid 2017-12-05 14:07:28 +00:00
parent 8de97dca14
commit e13a93dd75
2 changed files with 15 additions and 25 deletions

View File

@ -246,6 +246,18 @@ case "$HOMEBREW_COMMAND" in
--config) HOMEBREW_COMMAND="config" ;;
esac
# Set HOMEBREW_DEV_CMD_RUN for users who have run a development command.
# This makes them behave like HOMEBREW_DEVELOPERs for brew update.
if [[ -z "$HOMEBREW_DEVELOPER" ]]
then
export HOMEBREW_GIT_CONFIG_FILE="$HOMEBREW_REPOSITORY/.git/config"
HOMEBREW_GIT_CONFIG_DEVELOPERMODE="$(git config --file="$HOMEBREW_GIT_CONFIG_FILE" --get homebrew.devcmdrun 2>/dev/null)"
if [[ "$HOMEBREW_GIT_CONFIG_DEVELOPERMODE" = "true" ]]
then
export HOMEBREW_DEV_CMD_RUN="1"
fi
fi
if [[ -f "$HOMEBREW_LIBRARY/Homebrew/cmd/$HOMEBREW_COMMAND.sh" ]]
then
HOMEBREW_BASH_COMMAND="$HOMEBREW_LIBRARY/Homebrew/cmd/$HOMEBREW_COMMAND.sh"

View File

@ -59,35 +59,13 @@ do
export "$VAR_NEW"="${!VAR}"
done
# Set HOMEBREW_DEVELOPER for users who have run a development command
if [[ -z "$HOMEBREW_DEVELOPER" ]]
then
export HOMEBREW_GIT_CONFIG_FILE="$HOMEBREW_REPOSITORY/.git/config"
HOMEBREW_GIT_CONFIG_DEVELOPERMODE="$(git config --file="$HOMEBREW_GIT_CONFIG_FILE" --get homebrew.devcmdrun 2>/dev/null)"
if [[ "$HOMEBREW_GIT_CONFIG_DEVELOPERMODE" = "true" ]]
then
export HOMEBREW_DEV_CMD_RUN="1"
fi
fi
if [[ -z "$HOMEBREW_NO_ENV_FILTERING" ]]
then
if [[ -n "$HOMEBREW_DEVELOPER" || -n "$HOMEBREW_DEV_CMD_RUN" ]]
then
# Use env filtering by default for users who have run a development command
# This will be enabled by default for all users in future.
export HOMEBREW_ENV_FILTERING="1"
fi
else
unset HOMEBREW_ENV_FILTERING
fi
# test-bot sets environment filtering itself
if [[ -n "$HOMEBREW_ENV_FILTERING" && "$1" != "test-bot" ]]
# test-bot does environment filtering itself
if [[ -z "$HOMEBREW_NO_ENV_FILTERING" && "$1" != "test-bot" ]]
then
PATH="/usr/bin:/bin:/usr/sbin:/sbin"
FILTERED_ENV=()
# Filter all but the specific variables.
for VAR in HOME SHELL PATH TERM LOGNAME USER CI TRAVIS SSH_AUTH_SOCK SUDO_ASKPASS \
http_proxy https_proxy ftp_proxy HTTPS_PROXY FTP_PROXY \
"${!HOMEBREW_@}" "${!TRAVIS_@}" "${!JENKINS_@}"