Merge pull request #6690 from maxim-belkin/harden-brew-2.0
bin/brew: unset functions that override builtins
This commit is contained in:
commit
37b998d0ef
9
bin/brew
9
bin/brew
@ -19,6 +19,15 @@ symlink_target_directory() {
|
||||
quiet_cd "$directory" && quiet_cd "$target_dirname" && pwd -P
|
||||
}
|
||||
|
||||
# Enable and use default Bash builtins rather than user-defined functions
|
||||
builtin enable compgen unset
|
||||
for cmd in $(builtin compgen -A builtin)
|
||||
do
|
||||
builtin unset -f $cmd
|
||||
builtin enable $cmd
|
||||
done
|
||||
unset cmd
|
||||
|
||||
BREW_FILE_DIRECTORY="$(quiet_cd "${0%/*}/" && pwd -P)"
|
||||
HOMEBREW_BREW_FILE="${BREW_FILE_DIRECTORY%/}/${0##*/}"
|
||||
HOMEBREW_PREFIX="${HOMEBREW_BREW_FILE%/*/*}"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user