update: secure formula loading in rename
For update, all formula loading need to be secured by `rescue`. Otherwise it's easy to crash `brew update` for vasty reasons, e.g. new Formula DSL. Closes Homebrew/homebrew#43353. Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
parent
9520449823
commit
3458b99d6e
@ -78,7 +78,14 @@ module Homebrew
|
|||||||
next unless (dir = HOMEBREW_CELLAR/oldname).directory? && !dir.subdirs.empty?
|
next unless (dir = HOMEBREW_CELLAR/oldname).directory? && !dir.subdirs.empty?
|
||||||
|
|
||||||
begin
|
begin
|
||||||
migrator = Migrator.new(Formulary.factory("#{user}/#{repo}/#{newname}"))
|
f = Formulary.factory("#{user}/#{repo}/#{newname}")
|
||||||
|
rescue FormulaUnavailableError, *FormulaVersions::IGNORED_EXCEPTIONS
|
||||||
|
end
|
||||||
|
|
||||||
|
next unless f
|
||||||
|
|
||||||
|
begin
|
||||||
|
migrator = Migrator.new(f)
|
||||||
migrator.migrate
|
migrator.migrate
|
||||||
rescue Migrator::MigratorDifferentTapsError
|
rescue Migrator::MigratorDifferentTapsError
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user