diff options
| author | Mike McQuaid | 2016-08-25 19:19:48 +0100 |
|---|---|---|
| committer | GitHub | 2016-08-25 19:19:48 +0100 |
| commit | c39f0baa2169c2c65fd6aca2f33fac6e31899855 (patch) | |
| tree | 2c0d2950978b4e55c2a848493efe708cdc72d731 /Library | |
| parent | bf872672a83fcda84f0f574d1cae5f674ab22b8e (diff) | |
| parent | 27b0ca4b473461119d92b4c3f4a18cda5bc1cba7 (diff) | |
| download | brew-c39f0baa2169c2c65fd6aca2f33fac6e31899855.tar.bz2 | |
Merge pull request #808 from MikeMcQuaid/homebrew-root-complain
brew.sh: complain when running Homebrew as root.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/brew.sh | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh index 722a7750d..c7bc840e7 100644 --- a/Library/Homebrew/brew.sh +++ b/Library/Homebrew/brew.sh @@ -200,6 +200,21 @@ then fi check-run-command-as-root() { + [[ "$(id -u)" = 0 ]] || return + export HOMEBREW_NO_SANDBOX="1" + + [[ "$HOMEBREW_COMMAND" = "services" ]] && return + + onoe <<EOS +Running Homebrew as root is extremely dangerous. As Homebrew does not +drop privileges on installation you are giving all build scripts full access +to your system. As a result of the OS X sandbox not handling the root user +correctly HOMEBREW_NO_SANDBOX has been set so the sandbox will not be used. If +we have not merged a pull request to add privilege dropping by November 1st +2016 running Homebrew as root will be disabled. No Homebrew maintainers plan +to work on this functionality. +EOS + case "$HOMEBREW_COMMAND" in analytics|create|install|link|migrate|pin|postinstall|reinstall|switch|tap|\ tap-pin|update|upgrade|vendor-install) @@ -209,8 +224,6 @@ check-run-command-as-root() { ;; esac - [[ "$(id -u)" = 0 ]] || return - local brew_file_ls_info=($(ls -nd "$HOMEBREW_BREW_FILE")) if [[ "${brew_file_ls_info[2]}" != 0 ]] then |
