Skip to content

Conversation

@loplex
Copy link
Contributor

@loplex loplex commented Dec 15, 2025

When proctools is installed, brew test fails with a SIGTERM during cleanup. This happens because proctools provides pgrep/pkill binaries in HOMEBREW_PREFIX/bin, which behave differently than system binaries on macOS.

This fix forces the use of system binaries by prepending /usr/bin and /bin to PATH within the system call. It invokes commands via /usr/bin/env to bypass Ruby's internal command resolution, ensuring the modified PATH is respected during lookup.

This fix forces the use of system binaries in /usr/bin within the system call.

Fixes #21242

  • 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?

Copilot AI review requested due to automatic review settings December 15, 2025 11:24
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 resolves a conflict between Homebrew's brew test command and the proctools package. When proctools is installed, it provides incompatible pgrep and pkill binaries in HOMEBREW_PREFIX/bin that cause test cleanup to fail with SIGTERM. The fix ensures that system-provided binaries are used instead by modifying the PATH environment variable during cleanup.

Key Changes

  • Modified process cleanup logic in the ensure block to prepend /usr/bin:/bin to PATH
  • Used /usr/bin/env to invoke pgrep and pkill commands with the modified PATH
  • Removed the which() checks before invoking commands (now relying on system() return value)

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

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 1 changed files in this pull request and generated 1 comment.


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

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 1 changed files in this pull request and generated no new comments.


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

When `proctools` is installed, `brew test` fails with a SIGTERM during cleanup.
This happens because `proctools` provides `pgrep`/`pkill` binaries in `HOMEBREW_PREFIX/bin`,
which behave differently than system binaries on macOS.

This fix forces the use of system binaries in `/usr/bin` within the `system` call.

Fixes Homebrew#21242
@loplex loplex force-pushed the fix/21242_brew_test branch from 8346e33 to 14cd731 Compare December 15, 2025 12:16
@loplex
Copy link
Contributor Author

loplex commented Dec 15, 2025

So I can really rely on pgrep and pkill to always be inside /usr/bin on all supported systems?

I followed your propose and use absolute paths.
I have also updated code comments and commit message to reflect current state of changes.

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 1 changed files in this pull request and generated no new comments.


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

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!

@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Dec 15, 2025
Merged via the queue into Homebrew:main with commit 43f9748 Dec 15, 2025
36 checks passed
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 test fails with SIGTERM when proctools is installed (pgrep and pkill conflict and behavior difference)

2 participants