From f4103e5d61526cfbf7f31540ba45ec171adc452e Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 22 Jul 2022 10:33:43 +0100 Subject: [PATCH] bin/brew: never use HOMEBREW_PATH from users. Fixes https://github.com/Homebrew/brew/issues/13548 --- bin/brew | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/brew b/bin/brew index 32343baa25..9a06b0911c 100755 --- a/bin/brew +++ b/bin/brew @@ -75,7 +75,7 @@ HOMEBREW_LIBRARY="${HOMEBREW_REPOSITORY}/Library" # Copy and export all HOMEBREW_* variables previously mentioned in # manpage or used elsewhere by Homebrew. -for VAR in BAT_THEME BROWSER DISPLAY EDITOR NO_COLOR PATH TMUX DBUS_SESSION_BUS_ADDRESS +for VAR in BAT_THEME BROWSER DISPLAY EDITOR NO_COLOR TMUX DBUS_SESSION_BUS_ADDRESS do # Skip if variable value is empty. [[ -z "${!VAR}" ]] && continue @@ -109,6 +109,11 @@ then export CI="1" fi +# save the existing user path as HOMEBREW_PATH so it can be queried by +# e.g. brew doctor later. +HOMEBREW_PATH="${PATH}" +export HOMEBREW_PATH + # set from user environment # shellcheck disable=SC2154 if [[ -z "${HOMEBREW_NO_ENV_FILTERING}" ]]