From ab696cbbb7e313a3b29dba3372c8c14dfdfcf1fb Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Fri, 26 Aug 2022 22:23:02 +0800 Subject: [PATCH] linux/diagnostic: fix `rpath` returning `nil`. Fixes #13762. There's still a bug in the GCC linkage check, but I'll need a bit more time to work on a fix. This at least makes sure `brew doctor` will not return the error in the issue linked above. --- Library/Homebrew/extend/os/linux/diagnostic.rb | 3 ++- Library/Homebrew/os/linux/elf.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/extend/os/linux/diagnostic.rb b/Library/Homebrew/extend/os/linux/diagnostic.rb index d3d46cd79c..3971c62a65 100644 --- a/Library/Homebrew/extend/os/linux/diagnostic.rb +++ b/Library/Homebrew/extend/os/linux/diagnostic.rb @@ -144,6 +144,7 @@ module Homebrew gcc_dependents = Formula.installed.select do |formula| next false unless formula.tap&.core_tap? + # FIXME: This includes formulae that have no runtime dependency on GCC. formula.recursive_dependencies.map(&:name).include? "gcc" rescue TapFormulaUnavailableError false @@ -153,7 +154,7 @@ module Homebrew badly_linked = gcc_dependents.select do |dependent| keg = Keg.new(dependent.prefix) keg.binary_executable_or_library_files.any? do |binary| - paths = binary.rpath.split(":") + paths = binary.rpaths versioned_linkage = paths.any? { |path| path.match?(%r{lib/gcc/\d+$}) } unversioned_linkage = paths.any? { |path| path.match?(%r{lib/gcc/current$}) } diff --git a/Library/Homebrew/os/linux/elf.rb b/Library/Homebrew/os/linux/elf.rb index 73dd1b016e..67589cf6ac 100644 --- a/Library/Homebrew/os/linux/elf.rb +++ b/Library/Homebrew/os/linux/elf.rb @@ -97,7 +97,7 @@ module ELFShim # An array of runtime search path entries, such as: # ["/lib", "/usr/lib", "/usr/local/lib"] def rpaths - rpath.split(":") + rpath&.split(":").to_a end def interpreter