Improve error message for tap conflicts in brew install#20304
Improve error message for tap conflicts in brew install#20304MikeMcQuaid merged 1 commit intomainfrom
Conversation
brew install refuses to install a formula from a tap with the same name as an already installed keg|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
MikeMcQuaid
left a comment
There was a problem hiding this comment.
Make sure you're using brew typecheck and brew style --fix and fixing the errors. The CI syntax job is failing which it shouldn't be if you're doing this. Please also test the example scenario in the existing issue and report back in a comment if it's now working as expected:
$ brew install homebrew/core/postgresql@16
$ brew install mercurytechnologies/tap/postgresql@16
Warning: mercurytechnologies/tap/postgresql@16 16.3 is already installed.
The installed formula is from the homebrew/core tap, but you are trying to install from the mercurytechnologies/tap tap.
Formulae with the same name from different taps cannot be installed at the same time.
To install this version, you must first uninstall the existing formula:
brew uninstall postgresql@16
Then you can install the desired version:
brew install mercurytechnologies/tap/postgresql@16
Fixed all the syntax and style issues - both ✅ Tap conflict scenario: When installing ✅ No false positives: When both formulae are from the same tap, no conflict is detected and the original "just not linked" message would be shown. The implementation correctly follows the code review suggestions and handles the example scenario as expected. (6957599) Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
carlocab
left a comment
There was a problem hiding this comment.
This approach seems fine, but overly focused on the case where the currently-installed formula is either not linked or is keg-only. (Which is admittedly what the original issue was largely about.)
More generally, it would be good to check that we get useful behaviour and error messages when trying to install a formula from an external tap when an existing formula with the same name that is both linked and not keg-only is already installed.
You're absolutely right! I've extended the tap conflict detection beyond just unlinked/keg-only scenarios. The logic now properly handles the case where a linked, non-keg-only formula from an external tap is trying to be installed when an existing formula with the same name from a different tap is already installed. The tap conflict detection is now applied first, regardless of link status or keg-only status, ensuring users get the helpful tap conflict error message in all scenarios. (252c9fd) Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
252c9fd to
4e0be5e
Compare
Co-authored-by: MikeMcQuaid <125011+MikeMcQuaid@users.noreply.github.com> Co-authored-by: carlocab <30379873+carlocab@users.noreply.github.com>
4e0be5e to
ebb7168
Compare
When trying to install a formula from a different tap with the same name as an already installed formula,
brew installwould show a misleading warning message:This is confusing because the issue isn't that the formula is "just not linked" - it's that formulae with the same name from different taps cannot coexist in the same installation prefix.
Example scenario:
The fix detects when there's a tap conflict and provides a clear, actionable error message:
Technical details:
install_formula?method to compare the tap of the installed formula (fromkeg.tab.tap) with the tap of the formula being installedniltap by treating them as "homebrew/core"Fixes #17941.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
eu-central-1-1.aws.cloud2.influxdata.com/bin/curl --disable --cookie /dev/null --globoff --user-agent Linuxbrew/4.5.12-7-g3ec6f00 (Linux; x86_64 Ubuntu 24.04.2 LTS) curl/8.5.0 --header Accept-Language: en --fail --retry 3 --max-time 3 --header Authorization: Token iVdsgJ_OjvTYGAA79gOfWlA_fX0QCuj4eYUNdb-qVUTrC3tp3JTWCADVNE9HxV0kp2ZjIK9tuthy_teX4szr9A== --header Content-Type: text/plain; charset=utf-8 --header Accept: application/json --data-binary command_run,command=tests,ci=true,devcmdrun=true,developer=false options="--only= --verbose" 1753369534 --silent --output /dev/null REDACTED(dns block)/bin/curl --disable --cookie /dev/null --globoff --user-agent Linuxbrew/4.5.12-7-g3ec6f00 (Linux; x86_64 Ubuntu 24.04.2 LTS) curl/8.5.0 --header Accept-Language: en --fail --retry 3 --max-time 3 --header Authorization: Token iVdsgJ_OjvTYGAA79gOfWlA_fX0QCuj4eYUNdb-qVUTrC3tp3JTWCADVNE9HxV0kp2ZjIK9tuthy_teX4szr9A== --header Content-Type: text/plain; charset=utf-8 --header Accept: application/json --data-binary command_run,command=tests,ci=true,devcmdrun=true,developer=false options="--only= --verbose" 1753369736 --silent --output /dev/null REDACTED(dns block)/bin/curl --disable --cookie /dev/null --globoff --user-agent Linuxbrew/4.5.12-7-g3ec6f00 (Linux; x86_64 Ubuntu 24.04.2 LTS) curl/8.5.0 --header Accept-Language: en --fail --silent --retry 3 --max-time 3 --header Authorization: Token iVdsgJ_OjvTYGAA79gOfWlA_fX0QCuj4eYUNdb-qVUTrC3tp3JTWCADVNE9HxV0kp2ZjIK9tuthy_teX4szr9A== --header Content-Type: text/plain; charset=utf-8 --header Accept: application/json --data-binary command_run,command=tests,ci=true,devcmdrun=true,developer=false options="--only= --verbose" 1753369780 --silent --output /dev/null REDACTED(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.