Homebrew / homebrew-core

🍻 Default formulae for the missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
13.6k stars 12.35k forks source link

`macvim` is missing links such as `xxd`, which `vim` normally provides #182408

Closed 5HT2 closed 4 weeks ago

5HT2 commented 4 weeks ago

brew gist-logs <formula> link OR brew config AND brew doctor output

HOMEBREW_VERSION: 4.3.17-138-g36a0e53
ORIGIN: https://github.com/Homebrew/brew
HEAD: 36a0e539e4317dc0ed070004d7f83f5507c16332
Last commit: 2 hours ago
Core tap HEAD: 2e8f9483559b88adae72b533af482fbef2ddb57f
Core tap last commit: 5 days ago
Core tap JSON: 25 Aug 01:36 UTC
Core cask tap HEAD: 428ee3bec877d6aa7e1366348632a3d56d599731
Core cask tap last commit: 5 days ago
Core cask tap JSON: 25 Aug 01:36 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 8
HOMEBREW_SORBET_RUNTIME: set
Homebrew Ruby: 3.3.4 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/bin/ruby
CPU: octa-core 64-bit arm_firestorm_icestorm
Clang: 15.0.0 build 1500
Git: 2.39.3 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 14.6.1-arm64
CLT: 15.3.0.0.1.1708646388
Xcode: 15.4
Rosetta 2: false
# With vim linked

Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause formulae that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  macvim

# With macvim linked

Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause formulae that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  vim

# With macvim linked and vim uninstalled

Your system is ready to brew.

Verification

What were you trying to do (and why)?

Use xxd. For xxd reasons.

What happened (include all command output)?

The command output itself was as expected, but it lacked coloring.

I confirmed the following:

$ which xxd
/usr/bin/xxd

$ brew unlink macvim && brew link macvim
Unlinking /opt/homebrew/Cellar/macvim/9.1.0... 13 symlinks removed.
Linking /opt/homebrew/Cellar/macvim/9.1.0... 13 symlinks created.

$ which xxd
/usr/bin/xxd

$ ls /opt/homebrew/bin/ -latr
Sat Aug 24 21:42:01 2024 gview ⇒ ../Cellar/macvim/9.1.0/bin/gview
Sat Aug 24 21:42:01 2024 gvim ⇒ ../Cellar/macvim/9.1.0/bin/gvim
Sat Aug 24 21:42:01 2024 gvimdiff ⇒ ../Cellar/macvim/9.1.0/bin/gvimdiff
Sat Aug 24 21:42:01 2024 gvimex ⇒ ../Cellar/macvim/9.1.0/bin/gvimex
Sat Aug 24 21:42:01 2024 mview ⇒ ../Cellar/macvim/9.1.0/bin/mview
Sat Aug 24 21:42:01 2024 mvim ⇒ ../Cellar/macvim/9.1.0/bin/mvim
Sat Aug 24 21:42:01 2024 mvimdiff ⇒ ../Cellar/macvim/9.1.0/bin/mvimdiff
Sat Aug 24 21:42:01 2024 mvimex ⇒ ../Cellar/macvim/9.1.0/bin/mvimex
Sat Aug 24 21:42:01 2024 vi ⇒ ../Cellar/macvim/9.1.0/bin/vi
Sat Aug 24 21:42:01 2024 view ⇒ ../Cellar/macvim/9.1.0/bin/view
Sat Aug 24 21:42:01 2024 vim ⇒ ../Cellar/macvim/9.1.0/bin/vim
Sat Aug 24 21:42:01 2024 vimdiff ⇒ ../Cellar/macvim/9.1.0/bin/vimdiff
Sat Aug 24 21:42:01 2024 vimex ⇒ ../Cellar/macvim/9.1.0/bin/vimex

$ locate xxd | rg "homebrew.*vim.*bin/xxd"
/opt/homebrew/Cellar/macvim/9.1.0/MacVim.app/Contents/bin/xxd
/opt/homebrew/Cellar/vim/9.1.0600/bin/xxd

$ brew unlink vim
Unlinking /opt/homebrew/Cellar/vim/9.1.0600... 0 symlinks removed.

$ brew unlink macvim
Unlinking /opt/homebrew/Cellar/macvim/9.1.0... 13 symlinks removed.

$ brew link vim
Linking /opt/homebrew/Cellar/vim/9.1.0600... 187 symlinks created.

$ ls /opt/homebrew/bin/ -latr
Sat Aug 24 21:46:08 2024 ex ⇒ ../Cellar/vim/9.1.0600/bin/ex
Sat Aug 24 21:46:08 2024 rview ⇒ ../Cellar/vim/9.1.0600/bin/rview
Sat Aug 24 21:46:08 2024 rvim ⇒ ../Cellar/vim/9.1.0600/bin/rvim
Sat Aug 24 21:46:08 2024 vi ⇒ ../Cellar/vim/9.1.0600/bin/vi
Sat Aug 24 21:46:08 2024 view ⇒ ../Cellar/vim/9.1.0600/bin/view
Sat Aug 24 21:46:08 2024 vim ⇒ ../Cellar/vim/9.1.0600/bin/vim
Sat Aug 24 21:46:08 2024 vimdiff ⇒ ../Cellar/vim/9.1.0600/bin/vimdiff
Sat Aug 24 21:46:08 2024 vimtutor ⇒ ../Cellar/vim/9.1.0600/bin/vimtutor
Sat Aug 24 21:46:08 2024 xxd ⇒ ../Cellar/vim/9.1.0600/bin/xxd

$ realpath $(which xxd)
/opt/homebrew/Cellar/vim/9.1.0600/bin/xxd

$ ls -l $(which xxd)
Sat Aug 24 21:46:08 2024 /opt/homebrew/bin/xxd ⇒ ../Cellar/vim/9.1.0600/bin/xxd

What did you expect to happen?

I expected /opt/homebrew/Cellar/macvim/9.1.0/MacVim.app/Contents/bin/xxd to be linked, similar to how /opt/homebrew/Cellar/vim/9.1.0600/bin/xxd is linked.

This appears to be related to how brew chooses to hardcode which binaries it links, whereas it seems to just link vim binaries non-discriminately.

Relevant: https://github.com/Homebrew/homebrew-core/blob/61637fd1a69b64ffb9dd2adc96a8924be4f1efc0/Formula/v/vim.rb#L84-L92

https://github.com/Homebrew/homebrew-core/blob/61637fd1a69b64ffb9dd2adc96a8924be4f1efc0/Formula/m/macvim.rb#L76-L84

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

I have already included this above.
5HT2 commented 4 weeks ago

I am sorry about the formatting issue regarding the brew doctor output, I have now fixed this.

gromgit commented 4 weeks ago

This appears to be related to how brew chooses to hardcode which binaries it links, whereas it seems to just link vim binaries non-discriminately.

No, it's all in how the respective source builds work:

The person who created the macvim formula just wasn't interested in xxd, is all. That's easily fixed, though.