Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linkage_checker: skip files with incompatible architectures #18456

Merged
merged 2 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Library/Homebrew/extend/pathname.rb
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,11 @@
false
end

sig { params(_wanted_arch: Symbol).returns(T::Boolean) }
def arch_compatible?(_wanted_arch)
true

Check warning on line 474 in Library/Homebrew/extend/pathname.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/extend/pathname.rb#L474

Added line #L474 was not covered by tests
end

sig { returns(T::Array[String]) }
def rpaths
[]
Expand Down
1 change: 1 addition & 0 deletions Library/Homebrew/linkage_checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ def check_dylibs(rebuild_cache:)
@keg.find do |file|
next if file.symlink? || file.directory?
next if !file.dylib? && !file.binary_executable? && !file.mach_o_bundle?
next unless file.arch_compatible?(Hardware::CPU.arch)

# weakly loaded dylibs may not actually exist on disk, so skip them
# when checking for broken linkage
Expand Down
6 changes: 6 additions & 0 deletions Library/Homebrew/os/linux/elf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ def arch
end
end

def arch_compatible?(wanted_arch)
return true unless elf?

wanted_arch == arch
carlocab marked this conversation as resolved.
Show resolved Hide resolved
end

def elf_type
return :dunno unless elf?

Expand Down
Loading