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: report linkage with system frameworks #13570

Merged
merged 1 commit into from
Jul 19, 2022
Merged

linkage_checker: report linkage with system frameworks #13570

merged 1 commit into from
Jul 19, 2022

Conversation

carlocab
Copy link
Member

  • 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 style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

Currently, brew linkage reports linkage with system frameworks only if
they can be found on the file system. This results in this linkage not
being reported on Big Sur and newer, where system libraries are stored
in the dyld cache instead.

Let's fix that by avoiding silently ignoring system frameworks by moving
them out of #harmless_broken_link?. We retain the behaviour desired
from 7228e60 by deferring checking if a
broken library is actually a system framework to just before we add it
to @broken_dylibs.

To see how this changes the behaviour of brew linkage, here's an
example with this change:

❯ brew linkage neovim
System libraries:
  /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices
  /usr/lib/libSystem.B.dylib
  /usr/lib/libiconv.2.dylib
  /usr/lib/libutil.dylib
Homebrew libraries:
  /usr/local/opt/gettext/lib/libintl.8.dylib (gettext)
  /usr/local/opt/libtermkey/lib/libtermkey.1.dylib (libtermkey)
  /usr/local/opt/libuv/lib/libuv.1.dylib (libuv)
  /usr/local/opt/luajit/lib/libluajit-5.1.2.dylib (luajit)
  /usr/local/opt/luv/lib/libluv.1.dylib (luv)
  /usr/local/opt/msgpack/lib/libmsgpackc.2.dylib (msgpack)
  /usr/local/opt/tree-sitter/lib/libtree-sitter.0.dylib (tree-sitter)
  /usr/local/opt/unibilium/lib/libunibilium.4.dylib (unibilium)

and without this change:

❯ brew linkage neovim
System libraries:
  /usr/lib/libSystem.B.dylib
  /usr/lib/libiconv.2.dylib
  /usr/lib/libutil.dylib
Homebrew libraries:
  /usr/local/opt/gettext/lib/libintl.8.dylib (gettext)
  /usr/local/opt/libtermkey/lib/libtermkey.1.dylib (libtermkey)
  /usr/local/opt/libuv/lib/libuv.1.dylib (libuv)
  /usr/local/opt/luajit/lib/libluajit-5.1.2.dylib (luajit)
  /usr/local/opt/luv/lib/libluv.1.dylib (luv)
  /usr/local/opt/msgpack/lib/libmsgpackc.2.dylib (msgpack)
  /usr/local/opt/tree-sitter/lib/libtree-sitter.0.dylib (tree-sitter)
  /usr/local/opt/unibilium/lib/libunibilium.4.dylib (unibilium)

Currently, `brew linkage` reports linkage with system frameworks only if
they can be found on the file system. This results in this linkage not
being reported on Big Sur and newer, where system libraries are stored
in the dyld cache instead.

Let's fix that by avoiding silently ignoring system frameworks by moving
them out of `#harmless_broken_link?`. We retain the behaviour desired
from 7228e60 by deferring checking if a
broken library is actually a system framework to just before we add it
to `@broken_dylibs`.

To see how this changes the behaviour of `brew linkage`, here's an
example with this change:

    ❯ brew linkage neovim
    System libraries:
      /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices
      /usr/lib/libSystem.B.dylib
      /usr/lib/libiconv.2.dylib
      /usr/lib/libutil.dylib
    Homebrew libraries:
      /usr/local/opt/gettext/lib/libintl.8.dylib (gettext)
      /usr/local/opt/libtermkey/lib/libtermkey.1.dylib (libtermkey)
      /usr/local/opt/libuv/lib/libuv.1.dylib (libuv)
      /usr/local/opt/luajit/lib/libluajit-5.1.2.dylib (luajit)
      /usr/local/opt/luv/lib/libluv.1.dylib (luv)
      /usr/local/opt/msgpack/lib/libmsgpackc.2.dylib (msgpack)
      /usr/local/opt/tree-sitter/lib/libtree-sitter.0.dylib (tree-sitter)
      /usr/local/opt/unibilium/lib/libunibilium.4.dylib (unibilium)

and without this change:

    ❯ brew linkage neovim
    System libraries:
      /usr/lib/libSystem.B.dylib
      /usr/lib/libiconv.2.dylib
      /usr/lib/libutil.dylib
    Homebrew libraries:
      /usr/local/opt/gettext/lib/libintl.8.dylib (gettext)
      /usr/local/opt/libtermkey/lib/libtermkey.1.dylib (libtermkey)
      /usr/local/opt/libuv/lib/libuv.1.dylib (libuv)
      /usr/local/opt/luajit/lib/libluajit-5.1.2.dylib (luajit)
      /usr/local/opt/luv/lib/libluv.1.dylib (luv)
      /usr/local/opt/msgpack/lib/libmsgpackc.2.dylib (msgpack)
      /usr/local/opt/tree-sitter/lib/libtree-sitter.0.dylib (tree-sitter)
      /usr/local/opt/unibilium/lib/libunibilium.4.dylib (unibilium)
@BrewTestBot
Copy link
Member

Review period will end on 2022-07-19 at 04:05:57 UTC.

@BrewTestBot BrewTestBot added the waiting for feedback Merging is blocked until sufficient time has passed for review label Jul 18, 2022
@carlocab carlocab enabled auto-merge July 18, 2022 08:34
@Bo98
Copy link
Member

Bo98 commented Jul 18, 2022

I'm not sure I understand the scenario presented in the original issue. It seems like the desire was to ship binaries built on older macOS versions linked with frameworks that only exist on newer macOS versions. Why?

@carlocab
Copy link
Member Author

I'm not sure I understand the scenario presented in the original issue. It seems like the desire was to ship binaries built on older macOS versions linked with frameworks that only exist on newer macOS versions. Why?

This is not clear to me either. Maybe @fxcoudert remembers?

@fxcoudert
Copy link
Member

Nope, do not remember, sorry.

@BrewTestBot BrewTestBot removed the waiting for feedback Merging is blocked until sufficient time has passed for review label Jul 19, 2022
@BrewTestBot
Copy link
Member

Review period ended.

@carlocab carlocab merged commit 020c93a into Homebrew:master Jul 19, 2022
@carlocab carlocab deleted the report-system-framework-linkage branch July 19, 2022 06:04
@github-actions github-actions bot added the outdated PR was locked due to age label Aug 19, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants