From 2c1d8bcf6582ec7efc9870f9d4e4e9275804ac7e Mon Sep 17 00:00:00 2001 From: Vlad Shablinsky Date: Wed, 12 Aug 2015 16:13:10 +0300 Subject: [PATCH] migrator: check if old_opt_record exist before using realpath MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - check if old_opt_record exist before using realpath - don’t check old_opt_record.exist? in link_old_opt because it doesn’t have to exist. --- Library/Homebrew/migrator.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/migrator.rb b/Library/Homebrew/migrator.rb index fb01cf7f39..8e86d0853b 100644 --- a/Library/Homebrew/migrator.rb +++ b/Library/Homebrew/migrator.rb @@ -223,7 +223,7 @@ class Migrator # Link keg to opt if it was linked before migrating. def link_oldname_opt if old_opt_record - old_opt_record.delete if old_opt_record.symlink? || old_opt_record.exist? + old_opt_record.delete if old_opt_record.symlink? old_opt_record.make_relative_symlink(formula.installed_prefix) end end @@ -241,8 +241,9 @@ class Migrator # Remove opt/oldname link if it belongs to newname. def unlink_oldname_opt return unless old_opt_record - if old_opt_record.symlink? && formula.installed_prefix.exist? \ - && formula.installed_prefix.realpath == old_opt_record.realpath + if (old_opt_record.symlink? && old_opt_record.exist?) \ + && formula.installed_prefix.exist? \ + && formula.installed_prefix.realpath == old_opt_record.realpath old_opt_record.unlink old_opt_record.parent.rmdir_if_possible end