From 5619e5cc2c09167fb8e6165a4e6a1c2bb522a6bd Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Tue, 14 Feb 2023 02:31:12 +0000 Subject: [PATCH] formula: fix `to_hash` tampering with requirement names --- Library/Homebrew/formula.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 58a7e2e66194f..23d2208443e76 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -2156,9 +2156,10 @@ def to_hash end hsh["requirements"] = requirements.map do |req| - req.name.prepend("maximum_") if req.try(:comparator) == "<=" + req_name = req.name.dup + req_name.prepend("maximum_") if req.try(:comparator) == "<=" { - "name" => req.name, + "name" => req_name, "cask" => req.cask, "download" => req.download, "version" => req.try(:version) || req.try(:arch),