This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Abort if the HOMEBREW_PREFIX is not searchable

Without executable permissions on the prefix directory, permissions tests such
as `File.writable?` will fail and `File.chdir` will die with a strange error.

Fixes #14996.
  • Loading branch information...
1 parent 94dbaf0 commit 96905ebc241d13b01a32f861eeb24a36e8303fe0 @Sharpie Sharpie committed Sep 24, 2012
Showing with 8 additions and 0 deletions.
  1. +8 −0 install
View
@@ -89,6 +89,14 @@ It appears Homebrew is already installed. If your intent is to reinstall you
should do the following before running this installer again:
rm -rf #{HOMEBREW_PREFIX}/Cellar #{HOMEBREW_PREFIX}/.git && brew cleanup
EOABORT
+# Tests will fail if the prefix exists, but we don't have execution
+# permissions. Abort in this case.
+abort <<-EOABORT if File.directory? HOMEBREW_PREFIX and not File.executable? HOMEBREW_PREFIX
+The Homeprew prefix, #{HOMEBREW_PREFIX}, exists but is not searchable. If this is
+not intentional, please restore the default permissions and try running the
+installer again:
+ sudo chmod 755 #{HOMEBREW_PREFIX}
+EOABORT
ohai "This script will install:"
puts "#{HOMEBREW_PREFIX}/bin/brew"

0 comments on commit 96905eb

Please sign in to comment.