95 Commits

Author SHA1 Message Date
Bo Anderson
7da94a8f01
Preliminary macOS 15 (Sequoia) support 2024-06-11 02:59:31 +01:00
Mike McQuaid
1c6549517d
linkage_checker: test indirect dependencies.
Check for indirect dependencies with linkage with linkage in strict
test mode.

This should be done to ensure we accurately declare dependencies in
homebrew/core.
2024-05-14 12:12:19 +09:00
Markus Reiter
0b56d0be4a
Document Tab.for_keg and use Keg#tab where possible. 2024-04-28 20:50:13 +02:00
Markus Reiter
0f0055ede4
Make documentation @api private by default. 2024-04-26 19:04:20 +02:00
Mike McQuaid
ea2892f8ee
brew.rb: handle missing args. 2024-03-07 16:20:20 +00:00
Bo Anderson
b42256d286
Deprecate, disable & delete code for Homebrew 4.2.0 2023-12-07 23:42:13 +00:00
Rylan Polster
8704e79cc0
Separate MacOS references 2023-11-15 18:19:39 -05:00
Carlo Cabrera
cff8d8c155
Merge pull request #15571 from gerlero/relocate-relative-names
mac/keg_relocate: use relative install names
2023-07-11 04:38:26 +08:00
Gabriel Gerlero
15a0c7fd7d linkage_checker: resolve some variable install names on macOS 2023-07-06 14:15:14 -03:00
Mike McQuaid
7da934f7e2
Deprecate/disable/delete code.
The next release after this is merged will be 4.1.0.

Co-authored-by: Markus Reiter <me@reitermark.us>
2023-07-06 16:56:20 +01:00
Douglas Eichelberger
24cf6076e8 brew style --fix 2023-04-24 20:42:39 -07:00
Carlo Cabrera
957c2c983c
linkage_checker: ignore broken linkage with LLVM libc++.
This linkage will be broken in LLVM 15, but this is typically harmless
since dyld will load `/usr/lib/libc++.1.dylib` instead.
2022-09-19 12:37:32 +08:00
Bo Anderson
0593597a11
linkage_checker: don't reinstall formula on some linkage failures 2022-08-23 09:38:52 +01:00
Carlo Cabrera
e61bcb45f7
linkage_checker: report linkage with system frameworks
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 7228e60da51392b20d55e0c087b2082b86fb3bbf 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)
2022-07-18 12:04:24 +08:00
Bo Anderson
5d28c5166b
linkage_checker: deprecate linkage to libcrypt.so.1 2022-04-18 16:42:08 +01:00
Carlo Cabrera
39923cdb7f
linkage_checker: restrict RPATH test to --strict
This test is causing some rebuilds due to failed linkage upon upgrade.
That's a problem because rebuilds won't fix the problem that the `RPATH`
check identifies.
2022-03-10 07:09:47 +08:00
Chris Araman
440adcbec0
linkage: expand check to dylibs and bundles 2022-02-11 21:22:40 -08:00
Chris Araman
caf310038f
linkage: display executables with missing rpath
An executable that links against @rpath-prefixed dylibs must include at least
one runtime path. This will prevent issues like the one resolved in #91485.

Caveats:
1. This won't find executables that have only recursive dylib dependencies with
   @rpath prefixes.
2. This makes no attempt to resolve @rpath, @executable_path or @loader_path
   dylibs, or to verify the correctness of any LC_RPATH entries, or to
   otherwise simulate dlopen logic.
3. Weakly-linked dylibs are still excluded from the search for broken linkage.

The scope is narrow in order to focus on this particular problem. It is meant
only as a sanity check.
2021-12-20 13:44:35 -08:00
Carlo Cabrera
601bf83fee
linkage: add --strict flag to detect opportunistic linkage
There was a previous discussion about making `brew linkage --test` fail
for unrequested dependencies (#9172). I'm not sure what the outcome of
that was, but it still seems like a good idea to try to help us find
cases of opportunistic linkage as they happen rather than when they
cause CI failures in another PR sometime later.

Let's do this by adding a `--strict` flag to `brew linkage --test`. My
intention is for `brew linkage --test --strict` failures to be warnings
rather than errors in CI, which should mitigate some of the concerns
about doing this that were raised in #9172.
2021-11-19 18:14:38 +08:00
Carlo Cabrera
7bd5374dcc
Revert "linkage_checker: check variable references with dlopen"
Trying to `dlopen` some Qt libraries causes Ruby to crash.

This reverts commit 0191a275ccc3e1a9377c956751bbc1c4ba7b0cea.
2021-11-16 01:32:42 +08:00
Carlo Cabrera
0191a275cc
linkage_checker: check variable references with dlopen
The linkage check currently does nothing to check the validity of
variable-referenced libraries (prefixed with an `@`).

We could rectify that by mimicking the dynamic linker in looking up the
variable-referenced library, but this could get quite complicated.
Instead, let's let the linker do the hard work by checking if we can
`dlopen` libraries and bundles that contain variable linkage. The
`dlopen` will fail if the linker cannot resolve the variable reference.

There are at least two disadvantages to this approach relative to the
alternative suggested above:
1. This doesn't work for binary executables.
2. This doesn't identify which variable references are broken.

It's still better than not checking them at all, which is what we do
currently, and saves us from having to carry around code that parses and
verifies variable references directly.
2021-11-15 02:24:16 +08:00
Seeker
b9854bd4cf rubocops: add unless_multiple_conditions 2021-01-08 10:33:54 -08:00
Mike McQuaid
9216d8abe6
rubocop-rails: make fixes. 2020-12-02 10:43:04 +00:00
Mike McQuaid
7228e60da5
linkage_checker: system framework links are harmless.
These do not seem to cause runtime errors.

Fixes #9338
2020-11-30 16:00:42 +00:00
Mike McQuaid
7c56fa9caf
linkage: correctly detect missing kegs.
- manually `raise Errno::ENOENT` to ensure that a keg that doesn't exist
  isn't flagged as a system dependency.
- remove the inconsistent and incorrect summary messaging.
2020-11-27 13:12:09 +00:00
Markus Reiter
0184e271d8 Fix RuboCop offenses. 2020-11-17 11:09:55 +01:00
Markus Reiter
da9289eff0 Add more type signatures. 2020-11-13 12:26:36 +01:00
EricFromCanada
3768b7a6e9 apidoc: update comment wording, punctuation, formatting 2020-11-06 00:21:02 -05:00
Markus Reiter
24ae318a3d Move type annotations into files. 2020-10-10 14:59:39 +02:00
Markus Reiter
3a04377b51 Document LinkageChecker. 2020-08-26 03:13:59 +02:00
Maxim Belkin
4f119ad85f
linkage_checker.rb: Use ||= instead of "return ... if ... "
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2020-07-23 08:40:45 -05:00
Maxim Belkin
2918f92b89
linkage_checker.rb: fix indentation in display_items
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2020-07-23 08:38:42 -05:00
Maxim Belkin
590f77b111 Unexpected linkage 2020-07-22 17:25:16 +00:00
Maxim Belkin
42f90dba46 linkage_checker.rb: rename lib to broken_lib 2020-07-22 14:41:15 +00:00
Maxim Belkin
77a38aed0d linkage_checker.rb: meld allowed_missing_lib? into unexpected_broken_dylibs 2020-07-22 14:39:29 +00:00
Maxim Belkin
1b8c32c716 Move allowed_missing_libs? to linkage_checker.rb.
Optimize 'unexpected_broken_dylibs'
2020-07-22 14:30:52 +00:00
Maxim Belkin
28227bd26b linkage_checker.rb: replace conditional assignment with an if-else 2020-07-21 14:11:00 +00:00
Maxim Belkin
c61aba4ec3 Formula: ignore_missing_libraries DSL 2020-07-16 13:51:16 +00:00
Maxim Belkin
e7b3b8e559 Allow missing libraries 2020-07-16 13:51:16 +00:00
Mike McQuaid
f951ea83d4
Fix brew style. 2020-07-07 12:23:29 +01:00
Bo Anderson
9c4aaa9719 linkage_checker: handle system libraries on Big Sur 2020-06-24 16:27:57 +01:00
Mike McQuaid
dfa22680df
Autofix rubocop checks. 2020-02-19 11:24:12 +00:00
Mike McQuaid
36dbad3922
Add frozen_string_literal to all files. 2019-04-20 13:27:36 +09:00
Mike McQuaid
fe6b78a3f3
Use cache_store for descriptions
This makes use of both the existing interfaces and could use the
existing cache file but we'll create a new one and cleanup the old one
to avoid issues and use a more consistent name.
2018-10-13 08:22:52 -07:00
Markus Reiter
e9b9ea49a1 Update to RuboCop 0.59.1. 2018-09-17 03:45:59 +02:00
Markus Reiter
3a0a9f9073 Add String#delete_prefix backport. 2018-09-16 20:07:34 +02:00
Shaun Jackman
5cbddd2aca LinkageChecker: Report linkage of unwanted system libraries [Linux]
gcc and glibc are implicit dependencies on Linux.
No other linkage to system libraries is expected or desired.
2018-09-05 15:32:06 -07:00
Mike McQuaid
ca6c75d229
Check version conflicts using linkage.
Instead of refusing to install software preemptively by assuming
multiple linkage to differing versions of the same library we now make
`brew linkage --test` verify that we don't have two versions of the
same library linked at the same time.

This will be considerably more permissive whilst checking the actual
problem that we're worried about.
2018-08-27 10:12:02 +01:00
Mike McQuaid
375d401580 Handle missing formulae in runtime_dependencies
Hopefully put this to bed for once and for all. Add a new method
`runtime_formulae_dependencies` which returns the `runtime_dependencies`
which have only the `Formula` objects that exist. I've checked all the
`runtime_dependencies` callers and updated them accordingly.

Also, fix a few cases where runtime dependencies were being read from
the tab when this wasn't desirable.
2018-07-16 16:46:39 +01:00
Mike McQuaid
f5fbb74aaf linkage: fix output of optional dependencies.
Check the runtime dependencies from the tab when outputting the
`brew linkage` declared vs. undeclared dependencies.
2018-07-05 20:29:19 +01:00