Resolve src through realpath in install_renamed#22351
Merged
MikeMcQuaid merged 4 commits intoMay 20, 2026
Merged
Conversation
- Add test to install_etc_var
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a regression in InstallRenamed#append_default_if_different where, after a keg is opt-linked, the logic that detects “unchanged config matching an older bottled default” fails to locate sibling kegs in the Cellar, causing *.default files to be written unnecessarily and leaving untouched configs stale on upgrade.
Changes:
- Resolve the
srcpath throughrealpathbeforeascendso the walk is based on the Cellar path rather thanopt_prefix. - Add a new spec covering the opt-linked keg upgrade scenario for
Formula#install_etc_var.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
Library/Homebrew/install_renamed.rb |
Adjusts path resolution in append_default_if_different to make sibling-keg lookup work when the keg is opt-linked. |
Library/Homebrew/test/formula_spec.rb |
Adds a test reproducing the opt-linked keg scenario and asserting config replacement behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
7 tasks
MikeMcQuaid
reviewed
May 20, 2026
MikeMcQuaid
approved these changes
May 20, 2026
Member
MikeMcQuaid
left a comment
There was a problem hiding this comment.
Thanks @dariaguy, looks good and appreciate you taking the time to do this!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixing untouched etc configs being left stale on upgrade.
After the new keg is linked,
Formula#prefixreturnsopt_prefix, so the ascend inappend_default_if_differentwalks via theopt/symlink and theHOMEBREW_CELLARguard rejects every level — the sibling-keg lookup never runs and<file>.defaultis always written. Resolvingsrcthroughrealpathfirst puts the walk back on the cellar path so the lookup fires and untouched configs can advance on upgrade.Tested locally by adding a line to a conf in https://github.com/redis-developer/homebrew-core/blob/redis-add-line-to-conf/Formula/r/redis.rb, created a bottle and ran
brew upgrade redisbrew lgtm(style, typechecking and tests) with your changes locally?Used claude, verified manually the fix