Skip to content

Fix to not link keg_only if it doesn't installed by request#22119

Merged
MikeMcQuaid merged 1 commit intomainfrom
fix-auto-link-for-keg-only
May 2, 2026
Merged

Fix to not link keg_only if it doesn't installed by request#22119
MikeMcQuaid merged 1 commit intomainfrom
fix-auto-link-for-keg-only

Conversation

@daeho-ro
Copy link
Copy Markdown
Member

@daeho-ro daeho-ro commented May 2, 2026


  • 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 (excluding integration tests) for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

  • AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes.

From recent changes, installed_as_dependency value defaults to false and it is now changed to the reverse of installed_on_request. However, it's default value is also false and the test behavior is changed. I think the auto link guard should be kept and test should be fixed.

Copilot AI review requested due to automatic review settings May 2, 2026 06:39
Copy link
Copy Markdown
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 changes FormulaInstaller so versioned keg-only formulae are only auto-linked, and only emit the manual-link warning, when they were installed on request. That aligns linking behavior with Homebrew's installed-on-request semantics for top-level installs versus dependency installs.

Changes:

  • Add an installed_on_request? guard to auto_link_versioned_keg_only?.
  • Add the same guard to link_manual_command_warning.
  • Update formula_installer_spec.rb to cover the new default non-linking behavior for non-request installs and to keep the manual warning test on the request-install path.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
Library/Homebrew/formula_installer.rb Gates versioned keg-only auto-linking and manual-link warnings on installed_on_request?.
Library/Homebrew/test/formula_installer_spec.rb Adjusts installer specs for the new request-install behavior and updates one warning-path test.

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

Comment thread Library/Homebrew/test/formula_installer_spec.rb
Copy link
Copy Markdown
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!

@daeho-ro
Copy link
Copy Markdown
Member Author

daeho-ro commented May 2, 2026

One of docker step failed but it isn't related to the source changes.

@daeho-ro
Copy link
Copy Markdown
Member Author

daeho-ro commented May 2, 2026

@MikeMcQuaid MikeMcQuaid disabled auto-merge May 2, 2026 09:11
@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue May 2, 2026
Merged via the queue into main with commit 82198c5 May 2, 2026
59 of 64 checks passed
@MikeMcQuaid MikeMcQuaid deleted the fix-auto-link-for-keg-only branch May 2, 2026 09:35
@daeho-ro
Copy link
Copy Markdown
Member Author

daeho-ro commented May 2, 2026

This change is still not resolving the case that

During ghc@9.12 version bump, haskell-language-server have both ghc and ghc@9.12. Unfortunately, in this case, ghc@9.12 is installed first and linked, and laster ghc is trying to install. At this moment, ghc cannot make link because of there is already link to keg_only and failed by lock status. (not sure this statement is correct but this is my best)

This is very unique case and not sure how to resolve.

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.

3 participants