diff --git a/Library/Homebrew/dev-cmd/pr-pull.rb b/Library/Homebrew/dev-cmd/pr-pull.rb index b95242a443..68769d6dda 100644 --- a/Library/Homebrew/dev-cmd/pr-pull.rb +++ b/Library/Homebrew/dev-cmd/pr-pull.rb @@ -384,7 +384,7 @@ module Homebrew files_to_commits[file] ||= [] files_to_commits[file] << commit tap_file = (tap.path/file).to_s - if (tap_file.start_with?("#{tap.formula_dir}/") || tap_file.start_with?("#{tap.cask_dir}/")) && + if tap_file.start_with?("#{tap.formula_dir}/", "#{tap.cask_dir}/") && File.extname(file) == ".rb" next end diff --git a/Library/Homebrew/extend/os/mac/diagnostic.rb b/Library/Homebrew/extend/os/mac/diagnostic.rb index a30230f21f..4e08ae93fa 100644 --- a/Library/Homebrew/extend/os/mac/diagnostic.rb +++ b/Library/Homebrew/extend/os/mac/diagnostic.rb @@ -376,7 +376,7 @@ module OS return if @found.all? do |path| realpath = Pathname.new(path).realpath.to_s - allowlist.any? { |rack| realpath.start_with?(rack) } + realpath.start_with?(*allowlist) end end diff --git a/Library/Homebrew/extend/os/mac/keg_relocate.rb b/Library/Homebrew/extend/os/mac/keg_relocate.rb index 13c9ae62ae..0020a517a6 100644 --- a/Library/Homebrew/extend/os/mac/keg_relocate.rb +++ b/Library/Homebrew/extend/os/mac/keg_relocate.rb @@ -272,7 +272,7 @@ module OS # https://gitlab.kitware.com/cmake/cmake/-/issues/23251 return true if HOMEBREW_TEMP.to_s == "/private/tmp" && filename.start_with?("/tmp/") - filename.start_with?(HOMEBREW_TEMP.to_s) || filename.start_with?(HOMEBREW_TEMP.realpath.to_s) + filename.start_with?(HOMEBREW_TEMP.to_s, HOMEBREW_TEMP.realpath.to_s) end end end diff --git a/Library/Homebrew/shims/super/cc b/Library/Homebrew/shims/super/cc index 9fde835b6f..5ac3ad1981 100755 --- a/Library/Homebrew/shims/super/cc +++ b/Library/Homebrew/shims/super/cc @@ -281,7 +281,7 @@ class Cmd true # first two paths: reject references to Cellar or opt paths # for unspecified dependencies - elsif path.start_with?(cellar) || path.start_with?(opt) + elsif path.start_with?(cellar, opt) dep = path[keg_regex, 2] dep && @deps.include?(dep) elsif path.start_with?(prefix, cachedir, tmpdir) diff --git a/Library/Homebrew/unpack_strategy.rb b/Library/Homebrew/unpack_strategy.rb index 6b1fbe945d..7da5da4ff4 100644 --- a/Library/Homebrew/unpack_strategy.rb +++ b/Library/Homebrew/unpack_strategy.rb @@ -92,7 +92,7 @@ module UnpackStrategy strategies&.sort_by { |s| s.extensions.map(&:length).max || 0 } &.reverse - &.find { |s| s.extensions.any? { |ext| extension.end_with?(ext) } } + &.find { |s| extension.end_with?(*s.extensions) } end sig { params(path: Pathname).returns(T.nilable(UnpackStrategyType)) }