Skip to content

Fix cask installation conflicts with same-named formula binaries#20417

Merged
MikeMcQuaid merged 1 commit intomainfrom
copilot/fix-16309
Aug 12, 2025
Merged

Fix cask installation conflicts with same-named formula binaries#20417
MikeMcQuaid merged 1 commit intomainfrom
copilot/fix-16309

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Aug 11, 2025

When installing a cask after a formula with the same name (e.g., brew install docker followed by brew install --cask docker), the cask installation would fail with errors like:

Error: It seems there is already a Binary at '/opt/homebrew/etc/bash_completion.d/docker'.

This occurred because both the formula and cask tried to install files to the same locations (binaries, completion files), and the cask installer would fail when it encountered existing symlinks.

This PR adds intelligent conflict detection to the cask artifact installation process. When a cask tries to install a binary or completion file that already exists as a symlink from a formula with the same name:

  1. Detects the conflict by checking if the existing symlink points to the formula's Cellar directory
  2. Skips linking that specific file instead of failing
  3. Shows a clear warning message to inform the user
  4. Continues installation of non-conflicting artifacts

Example output after the fix:

==> Installing Cask docker
==> Moving App 'Docker.app' to '/Applications/Docker.app'
Warning: It seems there is already a Binary at '/usr/local/bin/docker' from formula docker; skipping.
Warning: It seems there is already a Bash Completion at '/opt/homebrew/etc/bash_completion.d/docker' from formula docker; skipping.
🍺  docker was successfully installed!

The solution allows both formula CLI tools and cask GUI applications to coexist, resolving a common user workflow issue while maintaining backward compatibility for all other cases.

Fixes #16309.

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
    • Triggering command: /bin/curl --disable --cookie /dev/null --globoff --user-agent Linuxbrew/4.6.0-61-gd85c5c9 (Linux; x86_64 Ubuntu 24.04.2 LTS) curl/8.5.0 --header Accept-Language: en --fail --progress-bar --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=typecheck,ci=true,devcmdrun=true,developer=false options="" 1754916917 --silent --output /dev/null REDACTED (dns block)
    • Triggering command: /bin/curl --disable --cookie /dev/null --globoff --user-agent Linuxbrew/4.6.0-61-gd85c5c9 (Linux; x86_64 Ubuntu 24.04.2 LTS) curl/8.5.0 --header Accept-Language: en --fail --progress-bar --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=typecheck,ci=true,devcmdrun=true,developer=false options="" 1754917362 --silent --output /dev/null REDACTED (dns block)
    • Triggering command: /bin/curl --disable --cookie /dev/null --globoff --user-agent Linuxbrew/4.6.0-61-gd85c5c9 (Linux; x86_64 Ubuntu 24.04.2 LTS) curl/8.5.0 --header Accept-Language: en --fail --progress-bar --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=typecheck,ci=true,devcmdrun=true,developer=false options="" 1754917376 --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:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] brew install --cask docker fails after having done brew install docker Fix cask installation conflicts with same-named formula binaries Aug 11, 2025
Copilot AI requested a review from MikeMcQuaid August 11, 2025 13:20
@MikeMcQuaid
Copy link
Copy Markdown
Member

@copilot address the review comments I've left inline on this PR

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Aug 11, 2025

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 addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • eu-central-1-1.aws.cloud2.influxdata.com
    • Triggering command: /bin/curl --disable --cookie /dev/null --globoff --user-agent Linuxbrew/4.6.0-63-gb6a3f85 (Linux; x86_64 Ubuntu 24.04.2 LTS) curl/8.5.0 --header Accept-Language: en --fail --progress-bar --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=typecheck,ci=true,devcmdrun=true,developer=false options="" 1754927619 --silent --output /dev/null REDACTED (dns block)
    • Triggering command: /bin/curl --disable --cookie /dev/null --globoff --user-agent Linuxbrew/4.6.0-63-gb6a3f85 (Linux; x86_64 Ubuntu 24.04.2 LTS) curl/8.5.0 --header Accept-Language: en --fail --progress-bar --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=style,ci=true,devcmdrun=true,developer=false options="--fix" 1754927632 --silent --output /dev/null REDACTED (dns block)
    • Triggering command: /bin/curl --disable --cookie /dev/null --globoff --user-agent Linuxbrew/4.6.0-63-gb6a3f85 (Linux; x86_64 Ubuntu 24.04.2 LTS) curl/8.5.0 --header Accept-Language: en --fail --progress-bar --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=" 1754927648 --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:

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.

@copilot please address these changes and edit the .github/copilot-instructions.md file based on my feedback e.g. no typed: strict needed for tests.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Aug 11, 2025

@copilot please address these changes and edit the .github/copilot-instructions.md file based on my feedback e.g. no typed: strict needed for tests.

I've addressed all the feedback by removing typed: strict from the test files and updating the copilot instructions to clarify that typed: strict is not needed for test files. Commit: 793ca7d

While we're at it, update copilot instructions.

Co-authored-by: MikeMcQuaid <[email protected]>
@MikeMcQuaid MikeMcQuaid marked this pull request as ready for review August 12, 2025 09:44
@MikeMcQuaid MikeMcQuaid enabled auto-merge August 12, 2025 10:00
@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Aug 12, 2025
Merged via the queue into main with commit 9626817 Aug 12, 2025
36 of 37 checks passed
@MikeMcQuaid MikeMcQuaid deleted the copilot/fix-16309 branch August 12, 2025 17:37
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.

brew install --cask docker fails after having done brew install docker

3 participants