From a0f9963391ee1062304f2ddabce84ec0aa2b7df7 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Thu, 10 Nov 2016 15:01:23 +0100 Subject: [PATCH] Disallow running `brew cask` as `root`. --- Library/Homebrew/brew.sh | 3 --- Library/Homebrew/cask/lib/hbc/cli/doctor.rb | 7 ------- 2 files changed, 10 deletions(-) diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh index d732ef9e24..92953001d3 100644 --- a/Library/Homebrew/brew.sh +++ b/Library/Homebrew/brew.sh @@ -240,9 +240,6 @@ fi check-run-command-as-root() { [[ "$(id -u)" = 0 ]] || return - # Homebrew Cask may need `sudo` for system-wide installation. - [[ "$HOMEBREW_COMMAND" = "cask" ]] && return - # Homebrew Services may need `sudo` for system-wide daemons. [[ "$HOMEBREW_COMMAND" = "services" ]] && return diff --git a/Library/Homebrew/cask/lib/hbc/cli/doctor.rb b/Library/Homebrew/cask/lib/hbc/cli/doctor.rb index dcccde13ff..4c5bf98e66 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/doctor.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/doctor.rb @@ -31,7 +31,6 @@ module Hbc ohai "Contents of $PATH Environment Variable:", render_env_var("PATH") ohai "Contents of $SHELL Environment Variable:", render_env_var("SHELL") ohai "Contents of Locale Environment Variables:", render_with_none(locale_variables) - ohai "Running As Privileged User:", render_with_none_as_error(privileged_uid) end def self.alt_taps @@ -107,12 +106,6 @@ module Hbc ENV.keys.grep(/^(?:LC_\S+|LANG|LANGUAGE)\Z/).collect { |v| %Q(#{v}="#{ENV[v]}") }.sort.join("\n") end - def self.privileged_uid - Process.euid.zero? ? "Yes #{error_string "warning: not recommended"}" : "No" - rescue StandardError - notfound_string - end - def self.none_string "" end