Commit Graph
14 Commits
Author SHA1 Message Date
Mike McQuaid 204ea7e964 Make tests use public APIs and enable their cops
- Make every statically-poked method public and call it directly,
  keeping `public_send` only for dynamically-named public methods.
- Read and write state through public `attr_*` accessors instead of
  instance variable reflection.
- Enable `Homebrew/NoSendInTests` and
  `Homebrew/NoInstanceVariableAccessInTests` now the test suite is
  clean, so neither pattern creeps back in.
- Keep rare justified disables, e.g. `Module#remove_const` is
  private core Ruby and raw memoisation state has no accessor.
2026-07-27 08:11:46 +01:00
Michael Cho 4981828baa os/linux/ld: fix type of @ld_so_diagnostics 2025-12-13 17:20:54 -05:00
Mike McQuaidandGitHub bd4eb5edc6 Only use MachOShim/ELFShim when required
Not including this globally in `Pathname` speeds up the creation of
other `Pathname` objects by ~200x making all of Homebrew faster.
2025-11-29 10:31:54 +00:00
Michael Cho 896edb4451 os/linux/ld: add support for using system ld.so 2025-09-05 09:04:21 -04:00
Xuehai Pan b2d621ce6f os/linux/ld: do not crash the program if the ld.so.conf entry is not readable 2025-08-11 19:40:41 +08:00
Mike McQuaidandClaude 23971854b0 Fix file descriptor leak in Linux LD library path parsing
The library_paths method was using readlines which could leave file
descriptors open due to Ruby's garbage collection behavior. When
processing many packages during 'brew upgrade' or 'brew linkage',
this caused "Too many open files" errors on Linux systems.

Changes:
- Replace readlines with explicit file.open block to ensure proper closure
- Add caching to avoid repeatedly reading /etc/ld.so.conf during a session
- Cache included files as well to optimize recursive include processing

Fixes: #19866, #20302, #19177, #20223

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-05 15:19:07 +01:00
Carlo Cabrera 65731faf1d os/linux/ld: handle nonexistent ld.so.conf more gracefully
Fixes #18458
2024-09-30 22:33:09 +08:00
Carlo Cabrera 1656d08629 os/linux/ld: drop retry logic
This is a hack, so let's see if we can get away with skipping it for
now.
2024-09-17 11:51:27 +08:00
Carlo CabreraandGitHub 70ab4932d3 Add link to issue with context 2024-09-17 01:03:34 +08:00
Carlo Cabrera bb20b3c720 os/linux/ld: harden brewed_ld_so_diagnostics against TypeError
I think this is a bug in Ruby, but I've no idea how to track it down. I
can reproduce it intermittently in a codespace when `brew install`ing a
large number of formulae.

To work around this:
- cache the return value of `brewed_ld_so_diagnostics` so that we can
  limit the number of calls to `IO.popen`
- retry once when we see a `TypeError`

Closes #17828.
2024-09-16 20:26:35 +08:00
Markus Reiter 0f0055ede4 Make documentation @api private by default. 2024-04-26 19:04:20 +02:00
Ruoyu ZhongandGitHub 916b37388d Revert "Revert "os/linux/elf: avoid using ldd for listing dynamic dependencies"" 2024-04-24 02:23:13 +08:00
Ruoyu ZhongandGitHub 852c5acb65 Revert "os/linux/elf: avoid using ldd for listing dynamic dependencies" 2024-04-16 02:50:12 +08:00
Caleb Xu c6b98d0b8c os/linux/ld: add functions for querying dynamic linker 2024-04-13 19:35:29 -04:00