Default environment filtering to on for all users.
This commit is contained in:
		
							parent
							
								
									8de97dca14
								
							
						
					
					
						commit
						e13a93dd75
					
				@ -246,6 +246,18 @@ case "$HOMEBREW_COMMAND" in
 | 
				
			|||||||
  --config)    HOMEBREW_COMMAND="config" ;;
 | 
					  --config)    HOMEBREW_COMMAND="config" ;;
 | 
				
			||||||
esac
 | 
					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" ]]
 | 
					if [[ -f "$HOMEBREW_LIBRARY/Homebrew/cmd/$HOMEBREW_COMMAND.sh" ]]
 | 
				
			||||||
then
 | 
					then
 | 
				
			||||||
  HOMEBREW_BASH_COMMAND="$HOMEBREW_LIBRARY/Homebrew/cmd/$HOMEBREW_COMMAND.sh"
 | 
					  HOMEBREW_BASH_COMMAND="$HOMEBREW_LIBRARY/Homebrew/cmd/$HOMEBREW_COMMAND.sh"
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										28
									
								
								bin/brew
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								bin/brew
									
									
									
									
									
								
							@ -59,35 +59,13 @@ do
 | 
				
			|||||||
  export "$VAR_NEW"="${!VAR}"
 | 
					  export "$VAR_NEW"="${!VAR}"
 | 
				
			||||||
done
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Set HOMEBREW_DEVELOPER for users who have run a development command
 | 
					# test-bot does environment filtering itself
 | 
				
			||||||
if [[ -z "$HOMEBREW_DEVELOPER" ]]
 | 
					if [[ -z "$HOMEBREW_NO_ENV_FILTERING" && "$1" != "test-bot" ]]
 | 
				
			||||||
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" ]]
 | 
					 | 
				
			||||||
then
 | 
					then
 | 
				
			||||||
  PATH="/usr/bin:/bin:/usr/sbin:/sbin"
 | 
					  PATH="/usr/bin:/bin:/usr/sbin:/sbin"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  FILTERED_ENV=()
 | 
					  FILTERED_ENV=()
 | 
				
			||||||
 | 
					  # Filter all but the specific variables.
 | 
				
			||||||
  for VAR in HOME SHELL PATH TERM LOGNAME USER CI TRAVIS SSH_AUTH_SOCK SUDO_ASKPASS \
 | 
					  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 \
 | 
					             http_proxy https_proxy ftp_proxy HTTPS_PROXY FTP_PROXY \
 | 
				
			||||||
             "${!HOMEBREW_@}" "${!TRAVIS_@}" "${!JENKINS_@}"
 | 
					             "${!HOMEBREW_@}" "${!TRAVIS_@}" "${!JENKINS_@}"
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user