Skip to content

Conversation

@carlocab
Copy link
Member

@carlocab carlocab commented Dec 1, 2025

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

Fixes #21150.

Sorbet hates this change, unfortunately, so it will need additional
fixes.

Copilot AI review requested due to automatic review settings December 1, 2025 03:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes linkage detection in LinkageChecker by wrapping Pathname objects with BinaryPathname.wrap() before calling binary-specific methods. The wrapped pathname provides OS-specific extensions (MachOShim on macOS or ELFShim on Linux) that implement methods like dylib?, binary_executable?, mach_o_bundle?, arch_compatible?, and dynamically_linked_libraries().

Key changes:

  • Adds BinaryPathname.wrap(file) call in the check_dylibs method to properly extend pathnames before binary analysis

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@carlocab
Copy link
Member Author

carlocab commented Dec 1, 2025

Actually, when testing this again, it doesn't fix it. Not sure why it worked properly briefly. Linkage cache probably.

@carlocab carlocab marked this pull request as draft December 1, 2025 03:44
@botantony
Copy link
Member

Actually, when testing this again, it doesn't fix it. Not sure why it worked properly briefly. Linkage cache probably.

It's just a cache issue

➜  Homebrew git:(main) brew cleanup --prune=all
Removing: /Users/antonmelnikov/Library/Caches/Homebrew/linkage.json... (65B)
==> This operation has freed approximately 65B of disk space.
➜  Homebrew git:(main) brew linkage libdvdread
Dependencies with no linkage:
  libdvdcss
➜  Homebrew git:(main) gh pr checkout 21151
branch 'fix-linkage' set up to track 'origin/fix-linkage'.
Switched to a new branch 'fix-linkage'
➜  Homebrew git:(fix-linkage) brew linkage libdvdread
System libraries:
  /usr/lib/libSystem.B.dylib
Homebrew libraries:
  /opt/homebrew/opt/libdvdcss/lib/libdvdcss.2.dylib (libdvdcss)
brew(main):002> keg = 'libdvdcss'.f.installed_kegs.first
=> #<Keg:/opt/homebrew/Cellar/libdvdcss/1.5.0>
brew(main):003> keg.find { |file| next if file.directory?; next unless file.dylib?; puts file }
=> nil
brew(main):004> keg.find { |file| file = BinaryPathname.wrap(file); next if file.directory?; next unless file.dylib?; puts file }
/opt/homebrew/Cellar/libdvdcss/1.5.0/lib/libdvdcss.2.dylib
/opt/homebrew/Cellar/libdvdcss/1.5.0/lib/libdvdcss.dylib
=> nil

@carlocab carlocab marked this pull request as ready for review December 1, 2025 04:17
Copilot AI review requested due to automatic review settings December 1, 2025 04:17
@carlocab
Copy link
Member Author

carlocab commented Dec 1, 2025

Ah, yes, it is just a cache issue. Still, it looks like doing this makes the generic tests fail.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 2 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • Library/Homebrew/extend/pathname.rbi: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Copilot AI review requested due to automatic review settings December 1, 2025 04:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.

Files not reviewed (1)
  • Library/Homebrew/extend/pathname.rbi: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@carlocab carlocab force-pushed the fix-linkage branch 2 times, most recently from 64de427 to 99ff593 Compare December 1, 2025 06:34
Copilot AI review requested due to automatic review settings December 1, 2025 06:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • Library/Homebrew/extend/pathname.rbi: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • Library/Homebrew/extend/pathname.rbi: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fix @carlocab! I'll fight with Sorbet for a slightly cleaner outcome here as we don't ever want to be creating actual BinaryPathname instances.

@MikeMcQuaid MikeMcQuaid enabled auto-merge December 1, 2025 08:46
@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Dec 1, 2025
Merged via the queue into main with commit 26f37d9 Dec 1, 2025
35 checks passed
@MikeMcQuaid MikeMcQuaid deleted the fix-linkage branch December 1, 2025 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

brew linkage does not report linkage correctly

4 participants