Match newlines in tap path regex #24303

Merged
p-linnane opened 8:13am on October 20, 2026 wanted to merge 52 Ξ” into homebrew/brew main from
tap-trust-newline
Diff Delta:
52
About 43 Diff Delta/hour
Classified as:  General

p-linnane's Description of Work

HOMEBREW_TAP_PATH_REGEX matched the rest of a path with ., which stops at a newline, so Tap.from_path returned nil for a path inside a tap that contains one or, if an absolute tap path follows the newline, that other tap. Matching across newlines makes such paths resolve to the tap they are in; new examples cover LF, CRLF and embedded tap paths.



  • [x] Have you followed our Contributing guidelines?

  • [x] Have you checked for other open Pull Requests for the same change?

  • [x] Have you explained what your changes do? Performance claims (e.g. "this is faster") must include brew benchmark results.

  • [x] Have you explained why you'd like these changes included, not just what they do?

  • [ ] For bug fixes, have you given step-by-step brew commands to reproduce the bug?

  • [x] Have you written new tests (excluding integration tests)? Here's an example.

  • [x] Have you successfully run brew lgtm (style, typechecking and tests) locally?



  • [x] I did not use AI/LLM to create this PR, or I disclosed the tool/model below and reviewed its output; I did not attribute commits to AI and will answer maintainer questions and review comments myself without AI/LLM.

Codex (GPT-6 Astra) wrote the change and tests, checked that the new examples fail without the change and ran brew lgtm --online. Claude Code (Opus 5.5) reviewed the change and its callers and suggested the embedded tap path example.


Summary by CodeRabbit



  • Bug Fixes


    • Improved handling of tap and formula paths containing line breaks.

    • Prevented untrusted formula paths with line breaks from being treated as trusted or evaluated.

    • Ensured paths containing another tap’s path resolve to the correct tap.




  • Tests


    • Added coverage for LF and CRLF line breaks across formula, cask, and command paths.



3 total changed files
Loading changes...
You've made it to the end of the scroll.
No more diffs beyond this point