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

Pull Request Overview

  • Opened on October 20, 2026
  • Status Merged
  • Commit count 1 with first commit October 20, 2026

Total Delta

52 Total Diff Delta

Open Days

Open 16 weekdays

Test Delta

24 Diff Delta in Test Files
Breakdown by Phase

How long has this pull request spent in each phase of its lifecycle?

Fraction of total time Business days Phase
 
0.0 days Authoring 1 commit before pull request opened for review
 
0.0 days Awaiting first review
Set up deploy tracking to begin tracking full PR start-to-deploy times

Total time for pull request 0.0 business days from first commit authored to merge
Deploy tracking has not been set up

Author avatar

Match newlines in tap path regex

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.



Comments Threads Pending Resolution

MikeMcQuaid reviewed and approved this work on October 20, 2026
MikeMcQuaid left a comment

Thanks!

Resolved Comment Threads

No resolved comments have been left on this PR.