From 1d7856c4f11f92f0e2c26fbf99f4ef26a56c80ee Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Fri, 23 Sep 2022 06:00:26 +0800 Subject: [PATCH] formula_auditor: fix false negatives in `audit_gcc_dependency` This audit is mistakenly passing for formulae where `variations_dependencies` is an empty array. We can fix that by checking for `nil` instead. See Homebrew/homebrew-core#111280. --- Library/Homebrew/formula_auditor.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/formula_auditor.rb b/Library/Homebrew/formula_auditor.rb index 705d18fa78..b68a81f3df 100644 --- a/Library/Homebrew/formula_auditor.rb +++ b/Library/Homebrew/formula_auditor.rb @@ -892,8 +892,9 @@ module Homebrew # This variation either: # 1. does not exist # 2. has no variation-specific dependencies - # In either case, it matches Linux. - return false if variation_dependencies.blank? + # In either case, it matches Linux. We must check for `nil` because an empty + # array indicates that this variation does not depend on GCC. + return false if variation_dependencies.nil? # We found a non-Linux variation that depends on GCC. return false if variation_dependencies.include?("gcc") end