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

Improve error/warning when brew install refuses to install a formula from a tap with the same name as an already installed keg #17941

Open
9999years opened this issue Aug 2, 2024 · 8 comments
Labels
bug Reproducible Homebrew/brew bug help wanted We want help addressing this

Comments

@9999years
Copy link

9999years commented Aug 2, 2024

(Reworded by @MikeMcQuaid)

What did you expect to happen?

I expected Homebrew to be able to install two formulae with the same name from different taps. When this didn't work, I expected the error message to reference this

Step-by-step reproduction instructions (by running brew commands)

$ brew uninstall -f mercurytechnologies/tap/postgresql@16 homebrew/homebrew-core/postgresql@16
Uninstalling postgresql@16... (3,801 files, 68.4MB)

$ brew install homebrew/homebrew-core/postgresql@16
==> Downloading https://ghcr.io/v2/homebrew/core/postgresql/16/manifests/16.3
...
==> Summary
🍺  /opt/homebrew/Cellar/postgresql@16/16.3: 3,801 files, 68.4MB

$ brew install mercurytechnologies/homebrew-tap/postgresql@16
Warning: mercurytechnologies/tap/postgresql@16 16.3 is already installed, it's just not linked.
To link this version, run:
  brew link postgresql@16

Further, brew info will incorrectly claim that mercurytechnologies/tap/postgresql@16 is installed.

$ brew info mercurytechnologies/tap/postgresql@16
==> mercurytechnologies/tap/postgresql@16: stable 16.3
Object-relational database system
https://www.postgresql.org/
Installed
/opt/homebrew/Cellar/postgresql@16/16.3 (3,801 files, 68.4MB)
  Poured from bottle using the formulae.brew.sh API on 2024-08-02 at 12:35:48
From: https://github.com/MercuryTechnologies/homebrew-tap/blob/HEAD/Formula/[email protected]
License: PostgreSQL
==> Dependencies
Build: pkg-config ✔
Required: gettext ✔, icu4c ✔, krb5 ✔, lz4 ✔, openssl@3 ✔, readline ✔, zstd ✔
==> Caveats
This formula has created a default database cluster with:
  initdb --locale=C -E UTF-8 /opt/homebrew/var/postgresql@16
For more details, read:
  https://www.postgresql.org/docs/16/app-initdb.html

To start mercurytechnologies/tap/postgresql@16 now and restart at login:
  brew services start mercurytechnologies/tap/postgresql@16
Or, if you don't want/need a background service you can just run:
  LC_ALL="C" /opt/homebrew/opt/postgresql@16/bin/postgres -D /opt/homebrew/var/postgresql@16
==> Analytics
install: 6,224 (30 days), 20,812 (90 days), 62,627 (365 days)
install-on-request: 6,117 (30 days), 20,368 (90 days), 60,669 (365 days)
build-error: 11 (30 days)

Related issues

@9999years 9999years added the bug Reproducible Homebrew/brew bug label Aug 2, 2024
@Bo98
Copy link
Member

Bo98 commented Aug 2, 2024

I assumed that the tap name serves as a namespace to disambiguate the two casks and allow them to coexist.

It allows them to co-exist as a distinct installable items but it does not allow for both of them to be installed at the same time. This applies to both formulae and casks.

You can see that formulae are installed to $HOMEBREW_PREFIX/Cellar/<name> and that name is not a fully-qualified name. Similarly for casks: $HOMEBREW_PREFIX/Caskroom/<name>.

@MikeMcQuaid
Copy link
Member

As @Bo98 said. This is a WONTFIX, unfortunately, it's baked too hard into the Homebrew internals to realistically ever change it. The best workaround is to rename the formulae in your tap.

@MikeMcQuaid MikeMcQuaid closed this as not planned Won't fix, can't repro, duplicate, stale Aug 5, 2024
@9999years
Copy link
Author

Hm, I think it's a fine constraint to not allow two formulae with the same name to be installed at once, but I think the error message should indicate that — "a formula with the same name from tap ... is installed".

Also, I think we should have some callouts to this fact in the Homebrew documentation, which currently don't indicate that this is an issue.

@apainintheneck
Copy link
Contributor

I agree this should be better documented somewhere and the error message could be improved as well.

@apainintheneck apainintheneck reopened this Aug 6, 2024
@apainintheneck apainintheneck added the help wanted We want help addressing this label Aug 6, 2024
@apainintheneck apainintheneck changed the title brew install refuses to install a cask when another with the same name is installed Document that brew install refuses to install a package when another with the same name is installed Aug 6, 2024
@apainintheneck apainintheneck added documentation Documentation changes and removed bug Reproducible Homebrew/brew bug labels Aug 6, 2024
@MikeMcQuaid MikeMcQuaid closed this as not planned Won't fix, can't repro, duplicate, stale Aug 6, 2024
@MikeMcQuaid
Copy link
Member

Apologies for the confusion @9999years, this issue should not have been reopened yet.

I agree the documentation could be improved here but I don't think this issue as-is is the best way of describing the problem that needs addressed.

@9999years are you ok if I rework the original issue body to describe the (new) problem(s) that should be fixed here or would you rather a new issue is opened that is not attributed to you? Thanks!

@9999years
Copy link
Author

Feel free to rework the issue body, the template seemed really strict so I didn't want to "break the rules"

@MikeMcQuaid MikeMcQuaid changed the title Document that brew install refuses to install a package when another with the same name is installed Improve error/warning when brew install refuses to install a formula from a tap with the same name as an already installed keg Aug 7, 2024
@MikeMcQuaid
Copy link
Member

Thanks @9999years, done now!

@MikeMcQuaid MikeMcQuaid reopened this Aug 7, 2024
@MikeMcQuaid MikeMcQuaid added bug Reproducible Homebrew/brew bug and removed documentation Documentation changes labels Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Reproducible Homebrew/brew bug help wanted We want help addressing this
Projects
None yet
Development

No branches or pull requests

5 participants
@MikeMcQuaid @Bo98 @9999years @apainintheneck and others