Merge pull request #19517 from botantony/brew-doctor

fix: ignore broken kegs during gcc linkage test
This commit is contained in:
Mike McQuaid 2025-03-18 11:50:21 +00:00 committed by GitHub
commit 3f6d30f885
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -143,7 +143,14 @@ module OS
return if gcc_dependents.empty?
badly_linked = gcc_dependents.select do |dependent|
keg = Keg.new(dependent.prefix)
dependent_prefix = dependent.any_installed_prefix
# Keg.new() may raise an error if it is not a directory.
# As the result `brew doctor` may display `Error: <keg> is not a directory`
# instead of proper `doctor` information.
# There are other checks that test that, we can skip broken kegs.
next if dependent_prefix.nil? || !dependent_prefix.exist? || !dependent_prefix.directory?
keg = Keg.new(dependent_prefix)
keg.binary_executable_or_library_files.any? do |binary|
paths = binary.rpaths
versioned_linkage = paths.any? { |path| path.match?(%r{lib/gcc/\d+$}) }