Homebrew / homebrew-cask

🍻 A CLI workflow for the administration of macOS applications distributed as binaries
https://brew.sh
BSD 2-Clause "Simplified" License
20.94k stars 10.72k forks source link

alacritty cask introduces critical bug #185883

Closed hyperknot closed 1 month ago

hyperknot commented 1 month ago

Verification

Description of issue

Installing Alacritty via brew introduces two bugs, both of which are not present in the official DMG image.

  1. Bug 1: reported here, confirmed that it's not present by the DMG but is present by the brew installed version. https://github.com/alacritty/alacritty/issues/8180

This is really some crazy behaviour when the terminal is faked in a super weird way. Only brew installed Alacritty is doing this:

echo $SHELL && echo $BASH && echo $BASH_VERSION
/opt/homebrew/bin/bash
/opt/homebrew/bin/bash
3.2.57(1)-release

Terminal.app

echo $SHELL && echo $BASH && echo $BASH_VERSION
/opt/homebrew/bin/bash
/opt/homebrew/bin/bash
5.2.32(1)-release

WezTerm:

echo $SHELL && echo $BASH && echo $BASH_VERSION
/opt/homebrew/bin/bash
/opt/homebrew/bin/bash
5.2.32(1)-release

iTerm:

echo $SHELL && echo $BASH && echo $BASH_VERSION
/opt/homebrew/bin/bash
/opt/homebrew/bin/bash
5.2.32(1)-release

The other issue is adding a bash completion which is not compatible with macOS Bash version 3.2, reported here: https://github.com/orgs/Homebrew/discussions/5613#discussioncomment-10680619

Command that failed

opening Alacritty

Output of command with --verbose --debug


$ brew install alacritty --verbose --debug
==> Downloading https://formulae.brew.sh/api/formula.jws.json
/usr/bin/env /opt/homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --user-agent Homebrew/4.3.23\ \(Macintosh\;\ arm64\ Mac\ OS\ X\ 14.6.1\)\ curl/8.7.1 --header Accept-Language:\ en --fail --remote-time --output /Users/user/Library/Caches/Homebrew/api/formula.jws.json --location --time-cond /Users/user/Library/Caches/Homebrew/api/formula.jws.json --disable --cookie /dev/null --globoff --show-error --user-agent Homebrew/4.3.23\ \(Macintosh\;\ arm64\ Mac\ OS\ X\ 14.6.1\)\ curl/8.7.1 --header Accept-Language:\ en --fail --compressed --speed-limit 100 --speed-time 5 https://formulae.brew.sh/api/formula.jws.json
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 4511k  100 4511k    0     0  17.9M      0 --:--:-- --:--:-- --:--:-- 18.0M
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::NullLoader): loading alacritty
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::NullLoader): loading alacritty
==> Downloading https://formulae.brew.sh/api/cask.jws.json
/usr/bin/env /opt/homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --user-agent Homebrew/4.3.23\ \(Macintosh\;\ arm64\ Mac\ OS\ X\ 14.6.1\)\ curl/8.7.1 --header Accept-Language:\ en --fail --remote-time --output /Users/user/Library/Caches/Homebrew/api/cask.jws.json --location --time-cond /Users/user/Library/Caches/Homebrew/api/cask.jws.json --disable --cookie /dev/null --globoff --show-error --user-agent Homebrew/4.3.23\ \(Macintosh\;\ arm64\ Mac\ OS\ X\ 14.6.1\)\ curl/8.7.1 --header Accept-Language:\ en --fail --compressed --speed-limit 100 --speed-time 5 https://formulae.brew.sh/api/cask.jws.json
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1491k  100 1491k    0     0  7984k      0 --:--:-- --:--:-- --:--:-- 7977k
/opt/homebrew/Library/Homebrew/brew.rb (Cask::CaskLoader::FromAPILoader): loading alacritty
==> Cask::Installer#install
==> Printing caveats
==> Cask::Installer#fetch
==> Downloading https://github.com/alacritty/alacritty/releases/download/v0.13.2/Alacritty-v0.13.2.dmg
/usr/bin/env /opt/homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --show-error --user-agent Homebrew/4.3.23\ \(Macintosh\;\ arm64\ Mac\ OS\ X\ 14.6.1\)\ curl/8.7.1 --header Accept-Language:\ en --retry 3 --fail --location --silent --head https://github.com/alacritty/alacritty/releases/download/v0.13.2/Alacritty-v0.13.2.dmg
Already downloaded: /Users/user/Library/Caches/Homebrew/downloads/18f5c47d45ae65141518bf897f40a45a2ee8ce684334c69a54c9d05c936d32a0--Alacritty-v0.13.2.dmg
==> Checking quarantine support
/usr/bin/env /usr/bin/xattr -h
/usr/bin/env /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -target arm64-apple-macosx14 /opt/homebrew/Library/Homebrew/cask/utils/quarantine.swift
==> Quarantine is available.
==> Verifying Gatekeeper status of /Users/user/Library/Caches/Homebrew/downloads/18f5c47d45ae65141518bf897f40a45a2ee8ce684334c69a54c9d05c936d32a0--Alacritty-v0.13.2.dmg
/usr/bin/env /usr/bin/xattr -p com.apple.quarantine /Users/user/Library/Caches/Homebrew/downloads/18f5c47d45ae65141518bf897f40a45a2ee8ce684334c69a54c9d05c936d32a0--Alacritty-v0.13.2.dmg
==> /Users/user/Library/Caches/Homebrew/downloads/18f5c47d45ae65141518bf897f40a45a2ee8ce684334c69a54c9d05c936d32a0--Alacritty-v0.13.2.dmg is quarantined
==> Verifying checksum for '18f5c47d45ae65141518bf897f40a45a2ee8ce684334c69a54c9d05c936d32a0--Alacritty-v0.13.2.dmg'
/usr/bin/env hdiutil imageinfo -format /Users/user/Library/Caches/Homebrew/downloads/18f5c47d45ae65141518bf897f40a45a2ee8ce684334c69a54c9d05c936d32a0--Alacritty-v0.13.2.dmg
==> Installing Cask alacritty
==> Cask::Installer#stage
==> Extracting primary container
==> Using container class UnpackStrategy::Dmg for /Users/user/Library/Caches/Homebrew/downloads/18f5c47d45ae65141518bf897f40a45a2ee8ce684334c69a54c9d05c936d32a0--Alacritty-v0.13.2.dmg
/usr/bin/env hdiutil attach -plist -nobrowse -readonly -mountrandom /private/tmp/homebrew-dmg20240918-77770-affqlj /Users/user/Library/Caches/Homebrew/downloads/18f5c47d45ae65141518bf897f40a45a2ee8ce684334c69a54c9d05c936d32a0--Alacritty-v0.13.2.dmg
/usr/bin/env find . -print0
/usr/bin/env mkbom -s -i /private/tmp/20240918-77770-71sl47.list -- /private/tmp/20240918-77770-t25xa2.bom
/usr/bin/env ditto --bom /private/tmp/20240918-77770-t25xa2.bom -- /private/tmp/homebrew-dmg20240918-77770-affqlj/dmg.y4ot6Y /private/tmp/homebrew-unpack20240918-77770-dbrbyh
/usr/bin/env diskutil info -plist /private/tmp/homebrew-dmg20240918-77770-affqlj/dmg.y4ot6Y
/usr/bin/env diskutil eject /private/tmp/homebrew-dmg20240918-77770-affqlj/dmg.y4ot6Y
/usr/bin/env cp -pR /private/tmp/homebrew-unpack20240918-77770-dbrbyh/Alacritty.app/. /opt/homebrew/Caskroom/alacritty/0.13.2/Alacritty.app
==> Verifying Gatekeeper status of /Users/user/Library/Caches/Homebrew/downloads/18f5c47d45ae65141518bf897f40a45a2ee8ce684334c69a54c9d05c936d32a0--Alacritty-v0.13.2.dmg
/usr/bin/env /usr/bin/xattr -p com.apple.quarantine /Users/user/Library/Caches/Homebrew/downloads/18f5c47d45ae65141518bf897f40a45a2ee8ce684334c69a54c9d05c936d32a0--Alacritty-v0.13.2.dmg
==> /Users/user/Library/Caches/Homebrew/downloads/18f5c47d45ae65141518bf897f40a45a2ee8ce684334c69a54c9d05c936d32a0--Alacritty-v0.13.2.dmg is quarantined
==> Propagating quarantine from /Users/user/Library/Caches/Homebrew/downloads/18f5c47d45ae65141518bf897f40a45a2ee8ce684334c69a54c9d05c936d32a0--Alacritty-v0.13.2.dmg to /opt/homebrew/Caskroom/alacritty/0.13.2
/usr/bin/env /usr/bin/xattr -p com.apple.quarantine /Users/user/Library/Caches/Homebrew/downloads/18f5c47d45ae65141518bf897f40a45a2ee8ce684334c69a54c9d05c936d32a0--Alacritty-v0.13.2.dmg
/usr/bin/env /usr/bin/xargs -0 -- /bin/chmod -h u+w
/usr/bin/env /usr/bin/xargs -0 -- /usr/bin/xattr -w com.apple.quarantine 0181\;66ea0338\;Homebrew\\x20Cask\;6484870A-3F39-4DAF-9854-F264E85E4F9C
==> Creating metadata directory: /opt/homebrew/Caskroom/alacritty/.metadata/0.13.2/20240918160332.184
==> Creating metadata subdirectory: /opt/homebrew/Caskroom/alacritty/.metadata/0.13.2/20240918160332.184/Casks
==> Installing artifacts
==> Installing artifact of class Cask::Artifact::App
==> Moving App 'Alacritty.app' to '/Applications/Alacritty.app'
==> Installing artifact of class Cask::Artifact::Binary
==> Linking Binary 'alacritty' to '/opt/homebrew/bin/alacritty'
/usr/bin/env /bin/ln -h -f -s -- /opt/homebrew/Caskroom/alacritty/0.13.2/Alacritty.app/Contents/MacOS/alacritty /opt/homebrew/bin/alacritty
==> Installing artifact of class Cask::Artifact::Binary
==> Linking Binary '_alacritty' to '/opt/homebrew/share/zsh/site-functions/_alacritty'
/usr/bin/env /bin/ln -h -f -s -- /opt/homebrew/Caskroom/alacritty/0.13.2/Alacritty.app/Contents/Resources/completions/_alacritty /opt/homebrew/share/zsh/site-functions/_alacritty
==> Installing artifact of class Cask::Artifact::Binary
==> Linking Binary 'alacritty.bash' to '/opt/homebrew/etc/bash_completion.d/alacritty'
/usr/bin/env /bin/ln -h -f -s -- /opt/homebrew/Caskroom/alacritty/0.13.2/Alacritty.app/Contents/Resources/completions/alacritty.bash /opt/homebrew/etc/bash_completion.d/alacritty
==> Adding com.apple.metadata:kMDItemAlternateNames metadata
/usr/bin/env /usr/bin/xattr -p com.apple.metadata:kMDItemAlternateNames /opt/homebrew/Caskroom/alacritty/0.13.2/Alacritty.app/Contents/Resources/completions/alacritty.bash
==> Existing metadata is:
/usr/bin/env /bin/chmod -- u+rw /opt/homebrew/Caskroom/alacritty/0.13.2/Alacritty.app/Contents/Resources/completions/alacritty.bash /Applications/Alacritty.app/Contents/Resources/completions/alacritty.bash
/usr/bin/env /usr/bin/xattr -w com.apple.metadata:kMDItemAlternateNames \(\"alacritty\"\) /opt/homebrew/Caskroom/alacritty/0.13.2/Alacritty.app/Contents/Resources/completions/alacritty.bash
==> Installing artifact of class Cask::Artifact::Binary
==> Linking Binary 'alacritty.fish' to '/opt/homebrew/share/fish/vendor_completions.d/alacritty.fish'
/usr/bin/env /bin/ln -h -f -s -- /opt/homebrew/Caskroom/alacritty/0.13.2/Alacritty.app/Contents/Resources/completions/alacritty.fish /opt/homebrew/share/fish/vendor_completions.d/alacritty.fish
==> Installing artifact of class Cask::Artifact::Binary
==> Linking Binary 'alacritty' to '/Users/user/.terminfo/61/alacritty'
/usr/bin/env /bin/ln -h -f -s -- /opt/homebrew/Caskroom/alacritty/0.13.2/Alacritty.app/Contents/Resources/61/alacritty /Users/user/.terminfo/61/alacritty
==> Installing artifact of class Cask::Artifact::Binary
==> Linking Binary 'alacritty-direct' to '/Users/user/.terminfo/61/alacritty-direct'
/usr/bin/env /bin/ln -h -f -s -- /opt/homebrew/Caskroom/alacritty/0.13.2/Alacritty.app/Contents/Resources/61/alacritty-direct /Users/user/.terminfo/61/alacritty-direct
==> Installing artifact of class Cask::Artifact::Manpage
==> Linking Manpage 'alacritty.1.gz' to '/opt/homebrew/share/man/man1/alacritty.1.gz'
/usr/bin/env /bin/ln -h -f -s -- /opt/homebrew/Caskroom/alacritty/0.13.2/Alacritty.app/Contents/Resources/alacritty.1.gz /opt/homebrew/share/man/man1/alacritty.1.gz
==> Installing artifact of class Cask::Artifact::Manpage
==> Linking Manpage 'alacritty.5.gz' to '/opt/homebrew/share/man/man5/alacritty.5.gz'
/usr/bin/env /bin/ln -h -f -s -- /opt/homebrew/Caskroom/alacritty/0.13.2/Alacritty.app/Contents/Resources/alacritty.5.gz /opt/homebrew/share/man/man5/alacritty.5.gz
==> Installing artifact of class Cask::Artifact::Manpage
==> Linking Manpage 'alacritty-msg.1.gz' to '/opt/homebrew/share/man/man1/alacritty-msg.1.gz'
/usr/bin/env /bin/ln -h -f -s -- /opt/homebrew/Caskroom/alacritty/0.13.2/Alacritty.app/Contents/Resources/alacritty-msg.1.gz /opt/homebrew/share/man/man1/alacritty-msg.1.gz
==> Installing artifact of class Cask::Artifact::Manpage
==> Linking Manpage 'alacritty-bindings.5.gz' to '/opt/homebrew/share/man/man5/alacritty-bindings.5.gz'
/usr/bin/env /bin/ln -h -f -s -- /opt/homebrew/Caskroom/alacritty/0.13.2/Alacritty.app/Contents/Resources/alacritty-bindings.5.gz /opt/homebrew/share/man/man5/alacritty-bindings.5.gz
🍺  alacritty was successfully installed!
Warning: HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK is set: not checking for outdated
dependents or dependents with broken linkage!

Output of brew doctor and brew config

brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Some installed kegs have no formulae!
This means they were either deleted or installed manually.
You should find replacements for the following formulae:
  mitmproxy

Warning: Some installed formulae are deprecated or disabled.
You should find replacements for the following formulae:
  openssl@1.1

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:
  pmix
brew config
HOMEBREW_VERSION: 4.3.23
ORIGIN: https://github.com/Homebrew/brew
HEAD: 42c11a4dedf352229271593de831161071603c66
Last commit: 2 days ago
Core tap JSON: 17 Sep 23:20 UTC
Core cask tap JSON: 17 Sep 23:20 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_EDITOR: subl_wait
HOMEBREW_MAKE_JOBS: 10
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: set
Homebrew Ruby: 3.3.4 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/bin/ruby
CPU: 10-core 64-bit arm_firestorm_icestorm
Clang: 15.0.0 build 1500
Git: 2.40.1 => /opt/homebrew/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

### Output of `brew tap`

```shell
brew tap
homebrew/services
daeho-ro commented 1 month ago

I can't reproduce, and bash completion is just moved from .app into the Homebrew managed folder, I didn't think it is problem of Homebrew.

hyperknot commented 1 month ago

I mean for bash completion, isn't this line present?

complete -F _alacritty -o nosort -o bashdefault -o default alacritty

That by definition triggers an error in bash 3.2

bevanjkay commented 1 month ago

The cask file is setup to install the bash completion that is present in Alacritty's .app bundle.

  binary "Alacritty.app/Contents/Resources/completions/alacritty.bash",
         target: "#{HOMEBREW_PREFIX}/etc/bash_completion.d/alacritty"

The line you mentioned does exist inside of Alacritty's completion file. complete -F _alacritty -o nosort -o bashdefault -o default alacritty

https://github.com/alacritty/alacritty/blob/8dfd2e56ad7aaeaf09aaf9f680420cc5988155b0/extra/completions/alacritty.bash#L464-L468

hyperknot commented 1 month ago

I see, than it's weird that the developer closed my issue with: https://github.com/alacritty/alacritty/issues/8180#issuecomment-2358581656

alacritty doesn't create any files, including the completions. So whatever you got installed is done by your package manager of choice.

Anyway, I'm not using Alacritty anymore because of these issues, I just wanted to report it here, probably the next person will also run into it.

khipp commented 1 month ago

@hyperknot I was able to reproduce the issue based on the steps you provided in https://github.com/orgs/Homebrew/discussions/5614.

Am I correct in assuming that you did not log out or reboot after changing your default login shell with chsh -s /opt/homebrew/bin/bash? If so, doing either of these should resolve your issue with Alacritty.

hyperknot commented 1 month ago

@khipp Yes, I didn't reboot or log out, just restarted the terminal.

Interesting that it's not needed for the other terminals, but it's good to know that a re-login would fix it.

khipp commented 1 month ago

Closing as this is not a bug with Homebrew.