From 1194880cf24be1bf42f977783847d7fb51abb77b Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Thu, 23 May 2013 11:16:24 -0500 Subject: doctor: fix check_for_broken_symlinks Fixes Homebrew/homebrew#20000. --- Library/Homebrew/cmd/doctor.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Library') diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb index c7d158a6d..45c71ebc6 100644 --- a/Library/Homebrew/cmd/doctor.rb +++ b/Library/Homebrew/cmd/doctor.rb @@ -202,10 +202,12 @@ end def check_for_broken_symlinks require 'keg' broken_symlinks = [] - Keg::PRUNEABLE_DIRECTORIES.each do |d| - next unless d.directory? - d.find do |pn| - broken_symlinks << pn if pn.symlink? and pn.readlink.expand_path.to_s =~ /^#{HOMEBREW_PREFIX}/o and not pn.exist? + + Keg::PRUNEABLE_DIRECTORIES.select(&:directory?).each do |d| + d.find do |path| + if path.symlink? && !path.resolved_path_exists? + broken_symlinks << path + end end end unless broken_symlinks.empty? then <<-EOS.undent -- cgit v1.2.3