From 7223f8ef74f273366d1bd7c2aa7e6a2023ecf04f Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Tue, 12 Oct 2021 13:49:53 +0800 Subject: [PATCH] Fix universal binary handling in `check_flat_namespace` --- Library/Homebrew/extend/os/mac/formula_cellar_checks.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/extend/os/mac/formula_cellar_checks.rb b/Library/Homebrew/extend/os/mac/formula_cellar_checks.rb index e2fbb294ea..515cbbdd0d 100644 --- a/Library/Homebrew/extend/os/mac/formula_cellar_checks.rb +++ b/Library/Homebrew/extend/os/mac/formula_cellar_checks.rb @@ -95,12 +95,13 @@ module FormulaCellarChecks keg = Keg.new(formula.prefix) flat_namespace_files = keg.mach_o_files.reject do |file| next true unless file.dylib? - # FIXME: macho.header.flag? is not defined when macho - # is a universal binary. - next true if file.universal? macho = MachO.open(file) - macho.header.flag?(:MH_TWO_LEVEL) + if file.universal? + macho.machos.map(&:header).all? { |h| h.flag? :MH_TWO_LEVEL } + else + macho.header.flag?(:MH_TWO_LEVEL) + end end return if flat_namespace_files.empty?