From 511598fa3731158a933aee6ee9a6014f339dc283 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Thu, 9 Feb 2012 17:32:41 -0600 Subject: install: unlink old kegs If a formula makes it all the way to the actual install step, it is safe to unlink the keg before linking; this will prune dead symlinks in the case where a keg was removed with `rm -rf ` but not unlinked with `brew unlink`. Fixes Homebrew/homebrew#10077. Signed-off-by: Jack Nagel --- Library/Homebrew/cmd/install.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Library') diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 5aa198f31..4260eaac9 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -103,6 +103,10 @@ module Homebrew extend self begin fi = FormulaInstaller.new(f) fi.install + # Due to the nature of Keg#unlink, this will remove symlinks from an + # older keg, which may still be present if an uninstallation was done + # via `rm -rf `; this is desired. + Keg.new("#{f.rack}/#{f.version}").unlink fi.caveats fi.finish rescue FormulaAlreadyInstalledError => e -- cgit v1.2.3