From 5eae33b59da181ff6f973aee19326f80c0d0fa2e Mon Sep 17 00:00:00 2001 From: Michka Popoff Date: Sun, 5 Jul 2020 22:24:03 +0200 Subject: [PATCH] link_overwrite: allow to overwrite files from alias See https://github.com/Homebrew/homebrew-core/pull/54912#issuecomment-653893645 Formulary.factory("python") points to python@3.8, which breaks link_overwrite for that case. This changes checks if the formula is an alias, so that we can still override the files during installation. --- Library/Homebrew/formula.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index de5bd23054..b529758020 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -1112,13 +1112,15 @@ class Formula return false if tab_tap.nil? begin - Formulary.factory(keg.name) + f = Formulary.factory(keg.name) rescue FormulaUnavailableError # formula for this keg is deleted, so defer to allowlist rescue TapFormulaAmbiguityError, TapFormulaWithOldnameAmbiguityError return false # this keg belongs to another formula else - return false # this keg belongs to another formula + # this keg belongs to another formula + # but it is not an alias + return false unless f.aliases.include? keg.name end end to_check = path.relative_path_from(HOMEBREW_PREFIX).to_s