aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorXu Cheng2015-08-28 15:59:53 +0800
committerXu Cheng2015-08-28 17:15:18 +0800
commit3458b99d6e46ac9010170a874de036ae659ffe47 (patch)
tree9625a3f8e732b3b4b654d2e44261ff9507bb28cf /Library
parent9520449823e4ffe7028d2e2b36ff1d3a9add9a60 (diff)
downloadbrew-3458b99d6e46ac9010170a874de036ae659ffe47.tar.bz2
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>
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/update.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/Library/Homebrew/cmd/update.rb b/Library/Homebrew/cmd/update.rb
index 83350988b..c6247765f 100644
--- a/Library/Homebrew/cmd/update.rb
+++ b/Library/Homebrew/cmd/update.rb
@@ -78,7 +78,14 @@ module Homebrew
next unless (dir = HOMEBREW_CELLAR/oldname).directory? && !dir.subdirs.empty?
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
rescue Migrator::MigratorDifferentTapsError
end