aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorBrandon Black2012-07-28 11:36:08 -0700
committerMax Howell2012-08-06 22:02:38 -0400
commit8aa4f9dd3bbd885350776171d3d9403d381e1a59 (patch)
treef9a55be1f445c4697adf8373161947f3ccaecf35 /Library
parent0bd72cb822a31a0b19f0bf7bddc3635faff92082 (diff)
downloadhomebrew-8aa4f9dd3bbd885350776171d3d9403d381e1a59.tar.bz2
Fix issues with writable? detection in brew doctor
Closes #13689. Signed-off-by: Max Howell <mxcl@me.com> There are subtle distinctions between writable? and writable_real? we don't understand precisely why we need this, but it fixes the bugs :/
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/Contributions/cmds/brew-unpack.rb2
-rw-r--r--Library/Contributions/install_homebrew.rb2
-rw-r--r--Library/Homebrew/cmd/doctor.rb6
-rw-r--r--Library/Homebrew/cmd/install.rb4
-rw-r--r--Library/Homebrew/extend/pathname.rb4
-rw-r--r--Library/Homebrew/global.rb2
6 files changed, 10 insertions, 10 deletions
diff --git a/Library/Contributions/cmds/brew-unpack.rb b/Library/Contributions/cmds/brew-unpack.rb
index d4d72623e..d25d38950 100755
--- a/Library/Contributions/cmds/brew-unpack.rb
+++ b/Library/Contributions/cmds/brew-unpack.rb
@@ -73,7 +73,7 @@ supplied, patches will also be downloaded and applied.
unpack_dir.mkpath unless unpack_dir.exist?
end
- raise "Cannot write to #{unpack_dir}" unless unpack_dir.writable?
+ raise "Cannot write to #{unpack_dir}" unless unpack_dir.writable_real?
formulae.each do |f|
# Create a nice name for the stage folder.
diff --git a/Library/Contributions/install_homebrew.rb b/Library/Contributions/install_homebrew.rb
index 3cf4f2f1c..14bda5ac2 100644
--- a/Library/Contributions/install_homebrew.rb
+++ b/Library/Contributions/install_homebrew.rb
@@ -84,7 +84,7 @@ chmods = %w( . bin etc include lib lib/pkgconfig Library sbin share var var/log
share/man/man5 share/man/man6 share/man/man7 share/man/man8
share/info share/doc share/aclocal ).
map{ |d| "/usr/local/#{d}" }.
- select{ |d| File.directory? d and not File.writable? d }
+ select{ |d| File.directory? d and not File.writable_real? d }
chgrps = chmods.reject{ |d| File.stat(d).grpowned? }
unless chmods.empty?
diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb
index aef52da87..1d46405b9 100644
--- a/Library/Homebrew/cmd/doctor.rb
+++ b/Library/Homebrew/cmd/doctor.rb
@@ -279,7 +279,7 @@ def __check_subdir_access base
target.find do |d|
next unless d.directory?
- cant_read << d unless d.writable?
+ cant_read << d unless d.writable_real?
end
cant_read.sort!
@@ -300,7 +300,7 @@ end
def check_access_usr_local
return unless HOMEBREW_PREFIX.to_s == '/usr/local'
- unless Pathname('/usr/local').writable? then <<-EOS.undent
+ unless Pathname('/usr/local').writable_real? then <<-EOS.undent
The /usr/local directory is not writable.
Even if this directory was writable when you installed Homebrew, other
software may change permissions on this directory. Some versions of the
@@ -322,7 +322,7 @@ end
def __check_folder_access base, msg
folder = HOMEBREW_PREFIX+base
- if folder.exist? and not folder.writable?
+ if folder.exist? and not folder.writable_real?
<<-EOS.undent
#{folder} isn't writable.
This can happen if you "sudo make install" software that isn't managed
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb
index 2d2d2903a..aa7987048 100644
--- a/Library/Homebrew/cmd/install.rb
+++ b/Library/Homebrew/cmd/install.rb
@@ -33,8 +33,8 @@ module Homebrew extend self
end
def check_writable_install_location
- raise "Cannot write to #{HOMEBREW_CELLAR}" if HOMEBREW_CELLAR.exist? and not HOMEBREW_CELLAR.writable?
- raise "Cannot write to #{HOMEBREW_PREFIX}" unless HOMEBREW_PREFIX.writable? or HOMEBREW_PREFIX.to_s == '/usr/local'
+ raise "Cannot write to #{HOMEBREW_CELLAR}" if HOMEBREW_CELLAR.exist? and not HOMEBREW_CELLAR.writable_real?
+ raise "Cannot write to #{HOMEBREW_PREFIX}" unless HOMEBREW_PREFIX.writable_real? or HOMEBREW_PREFIX.to_s == '/usr/local'
end
def check_xcode
diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb
index 14d902880..da0f641cb 100644
--- a/Library/Homebrew/extend/pathname.rb
+++ b/Library/Homebrew/extend/pathname.rb
@@ -353,7 +353,7 @@ class Pathname
To list all files that would be deleted:
brew link -n formula_name
EOS
- elsif !dirname.writable?
+ elsif !dirname.writable_real?
raise <<-EOS.undent
Could not symlink file: #{src.expand_path}
#{dirname} is not writable. You should change its permissions.
@@ -375,7 +375,7 @@ class Pathname
def ensure_writable
saved_perms = nil
- unless writable?
+ unless writable_real?
saved_perms = stat.mode
chmod 0644
end
diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb
index 0b58a6629..a8dd3b04e 100644
--- a/Library/Homebrew/global.rb
+++ b/Library/Homebrew/global.rb
@@ -16,7 +16,7 @@ def cache
# we do this for historic reasons, however the cache *should* be the same
# directory whichever user is used and whatever instance of brew is executed
home_cache = Pathname.new("~/Library/Caches/Homebrew").expand_path
- if home_cache.directory? and home_cache.writable?
+ if home_cache.directory? and home_cache.writable_real?
home_cache
else
root_cache = Pathname.new("/Library/Caches/Homebrew")
n> { var lastScope, onloadExp = attr.onload || ''; scope.$on('$routeChangeSuccess', update); update(); function destroyLastScope() { if (lastScope) { lastScope.$destroy(); lastScope = null; } } function clearContent() { element.html(''); destroyLastScope(); } function update() { var locals = $route.current && $route.current.locals, template = locals && locals.$template; if (template) { element.html(template); destroyLastScope(); var link = $compile(element.contents()), current = $route.current, controller; lastScope = current.scope = scope.$new(); if (current.controller) { locals.$scope = lastScope; controller = $controller(current.controller, locals); element.contents().data('$ngControllerController', controller); } link(lastScope); lastScope.$emit('$viewContentLoaded'); lastScope.$eval(onloadExp); // $anchorScroll might listen on event... $anchorScroll(); } else { clearContent(); } } } }; }];