Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix loading casks/formulae from relative paths. #16779

Merged
merged 1 commit into from
Mar 1, 2024

Conversation

reitermarkus
Copy link
Member

@reitermarkus reitermarkus commented Mar 1, 2024

  • 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 style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

I don't think there is a way to match everything except ./.. using a regex, so this adds two new methods to convert a tapped name (e.g. homebrew/core/gcc) into a pair of tap and name, matching all tapped names except those that look like relative paths, e.g. ./Formula/gcc.rb.

Fixes #16773.

@apainintheneck
Copy link
Contributor

I don't think there is a way to match everything except ./.. using a regex, so this adds two new methods to convert a tapped name (e.g. homebrew/core/gcc) into a pair of tap and name, matching all tapped names except those that look like relative paths, e.g.

Do we support periods in full tap name? If not, we could just update the regexes to ignore entries that have periods in the repo or user sections of the tapped name.

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 for quick turnaround here @reitermarkus! ❤️

Merging this ASAP to fix user issue but, in hindsight, I really wish we'd just left these regex alone instead of causing multiple user issues.

Please let's try to be more minimal and conservative with additional refactoring, thanks 🙇🏻

@MikeMcQuaid MikeMcQuaid merged commit f1eea64 into Homebrew:master Mar 1, 2024
26 checks passed
@reitermarkus
Copy link
Member Author

Do we support periods in full tap name?

Yes, we just weren't using these regexes consistently in Formulary, and e.g. Tap::fetch still does not validate the tap name in the same way currently.

I really wish we'd just left these regex alone instead of causing multiple user issues.

The regexes were silently broken for years, this had to surface at some point. Ideally we should just get rid of these regexes, as I think we now only have one usage of each outside of Tap.

@reitermarkus reitermarkus deleted the fix-load-from-path branch March 1, 2024 10:57
@MikeMcQuaid
Copy link
Member

The regexes were silently broken for years, this had to surface at some point. Ideally we should just get rid of these regexes, as I think we now only have one usage of each outside of Tap.

Sorry, "silently broken" but not causing users to file issues about things is definitely superior to "fixed" but breaking things for multiple users in multiple places.

Refactors like this are not worth it when they break things for actual users.

@github-actions github-actions bot added the outdated PR was locked due to age label Apr 3, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--build-from-source always gives 'Cask is unreadable: wrong constant name....' error
3 participants