diff options
| author | Mike McQuaid | 2016-11-09 11:15:23 +0000 | 
|---|---|---|
| committer | GitHub | 2016-11-09 11:15:23 +0000 | 
| commit | 1fb7d0fa5702f21d35ed3831419daa6f3ea24473 (patch) | |
| tree | 865fe8ffd3d3e2fc7585a83b1a54de43f355762d | |
| parent | a7dc9e1aac35dc1d2f0655d87cd2e1c77b6857a6 (diff) | |
| parent | 126c15d9ae7459bea801ef9d33f344e799c0f512 (diff) | |
| download | brew-1fb7d0fa5702f21d35ed3831419daa6f3ea24473.tar.bz2 | |
Merge pull request #1460 from woodruffw/audit-ignore-weak-linkage
os/mac: MachO.dynamically_linked_libraries filtering.
| -rw-r--r-- | Library/Homebrew/os/mac/linkage_checker.rb | 5 | ||||
| -rw-r--r-- | Library/Homebrew/os/mac/mach.rb | 8 | ||||
| -rw-r--r-- | Library/Homebrew/os/mac/pathname.rb | 2 | 
3 files changed, 10 insertions, 5 deletions
diff --git a/Library/Homebrew/os/mac/linkage_checker.rb b/Library/Homebrew/os/mac/linkage_checker.rb index e014e3816..e72227fc4 100644 --- a/Library/Homebrew/os/mac/linkage_checker.rb +++ b/Library/Homebrew/os/mac/linkage_checker.rb @@ -23,7 +23,10 @@ class LinkageChecker      @keg.find do |file|        next if file.symlink? || file.directory?        next unless file.dylib? || file.mach_o_executable? || file.mach_o_bundle? -      file.dynamically_linked_libraries.each do |dylib| + +      # weakly loaded dylibs may not actually exist on disk, so skip them +      # when checking for broken linkage +      file.dynamically_linked_libraries(except: :LC_LOAD_WEAK_DYLIB).each do |dylib|          @reverse_links[dylib] << file          if dylib.start_with? "@"            @variable_dylibs << dylib diff --git a/Library/Homebrew/os/mac/mach.rb b/Library/Homebrew/os/mac/mach.rb index 07598a23d..4113a0601 100644 --- a/Library/Homebrew/os/mac/mach.rb +++ b/Library/Homebrew/os/mac/mach.rb @@ -1,7 +1,7 @@  require "vendor/macho/macho"  require "os/mac/architecture_list" -module MachO +module MachOShim    # @private    def macho      @macho ||= begin @@ -51,8 +51,10 @@ module MachO      end    end -  def dynamically_linked_libraries -    macho.linked_dylibs +  def dynamically_linked_libraries(except: :none) +    lcs = macho.dylib_load_commands.reject { |lc| lc.type == except } + +    lcs.map(&:name).map(&:to_s)    end    def dylib_id diff --git a/Library/Homebrew/os/mac/pathname.rb b/Library/Homebrew/os/mac/pathname.rb index 9b65d7ac0..5fd59e1e7 100644 --- a/Library/Homebrew/os/mac/pathname.rb +++ b/Library/Homebrew/os/mac/pathname.rb @@ -1,5 +1,5 @@  require "os/mac/mach"  class Pathname -  include MachO +  include MachOShim  end  | 
