diff options
| author | Martin Afanasjew | 2016-02-04 14:46:31 +0100 |
|---|---|---|
| committer | Martin Afanasjew | 2016-02-05 22:07:07 +0100 |
| commit | 5f049637d9efab6d4433c34b6f7023cf9cd288d1 (patch) | |
| tree | b24759a9a0f14804377b3b4c382a9e83eed0b766 /Library | |
| parent | f9efa18be146dc4372ac9c7a3a60ec1ad14cbd46 (diff) | |
| download | brew-5f049637d9efab6d4433c34b6f7023cf9cd288d1.tar.bz2 | |
ENV: protect against environment being reset
We cannot really recover from this, but at least we'll provide a clearer
error message than trying to call `exec` with an empty string.
Diffstat (limited to 'Library')
| -rwxr-xr-x | Library/ENV/4.3/cc | 6 | ||||
| -rwxr-xr-x | Library/ENV/scm/git | 5 |
2 files changed, 10 insertions, 1 deletions
diff --git a/Library/ENV/4.3/cc b/Library/ENV/4.3/cc index 11d811508..2c6dc205e 100755 --- a/Library/ENV/4.3/cc +++ b/Library/ENV/4.3/cc @@ -2,6 +2,11 @@ # Make sure this shim uses the same Ruby interpreter that is used by Homebrew. unset RUBYLIB unset RUBYOPT +if [ -z "$HOMEBREW_RUBY_PATH" ] +then + echo "${0##*/}: The build tool has reset ENV; --env=std required." >&2 + exit 1 +fi exec "$HOMEBREW_RUBY_PATH" -x "$0" "$@" #!/usr/bin/env ruby -W0 @@ -308,7 +313,6 @@ end if __FILE__ == $PROGRAM_NAME ##################################################################### sanity - abort "The build-tool has reset ENV. --env=std required." unless ENV["HOMEBREW_BREW_FILE"] if (cc = ENV["HOMEBREW_CC"]).nil? || cc.empty? || cc == "cc" # those values are not allowed diff --git a/Library/ENV/scm/git b/Library/ENV/scm/git index 6124ffe5f..6d13a33a3 100755 --- a/Library/ENV/scm/git +++ b/Library/ENV/scm/git @@ -2,6 +2,11 @@ # Make sure this shim uses the same Ruby interpreter that is used by Homebrew. unset RUBYLIB unset RUBYOPT +if [ -z "$HOMEBREW_RUBY_PATH" ] +then + echo "${0##*/}: The build tool has reset ENV; --env=std required." >&2 + exit 1 +fi exec "$HOMEBREW_RUBY_PATH" -x "$0" "$@" #!/usr/bin/env ruby -W0 |
