With HOMEBREW_CASK_OPTS="--require-sha", brew bundle exits 0 even if installation is not successful
weakish opened this issue · comments
Provided that HOMEBREW_CASK_OPTS="--require-sha"
,
even if installation is not successful due to checksum not defined,
brew bundle
still exists 0 and not reporting any error.
For example: (chromium cask defines its sha256
checksum as :no_check
)
export HOMEBREW_CASK_OPTS="--require-sha"
echo 'cask "chromium"' | brew bundle --file=-
From the output, it seems everything is okay and chromium is installed:
==> Downloading https://formulae.brew.sh/api/cask.jws.json
Installing chromium
Homebrew Bundle complete! 1 Brewfile dependency now installed.
Also, the status code is 0.
; echo $?
0
However, in fact chromium is not installed:
; brew info chromium | fgrep 'Not installed'
Not installed
Strangely, running brew bundle
with the verbose option, brew exists 1 correctly:
; echo 'cask "chromium"' | brew bundle --file=- --verbose
Installing chromium
Installing chromium cask. It is not currently installed.
==> Downloading https://raw.githubusercontent.com/Homebrew/homebrew-cask/2786e56
Already downloaded: /Users/kyo/Library/Caches/Homebrew/downloads/a03ec19b95fb538ee676d9dd29426ec36977b638c0865408ab7dda1030f0ac33--chromium.rb
Error: Cask 'chromium' does not have a sha256 checksum defined and was not installed.
This means you have the --require-sha option set, perhaps in your HOMEBREW_CASK_OPTS.
Installing chromium has failed!
Homebrew Bundle failed! 1 Brewfile dependency failed to install.
; echo $?
1
Homebrew version: 4.2.2-18-gdcd267b
Wow, what timing — I was just about to file a very similar issue, although in my case the cask install failed due to a pre-existing .app
rather than --require-sha
. My guess is that both of these have the same root cause, since the same --verbose
behavior applies too.
Same version Homebrew 4.2.2-18-gdcd267b
$ echo 'cask "emacs"' | brew bundle install --file=- ; echo $?
Installing emacs
Homebrew Bundle complete! 1 Brewfile dependency now installed.
0
$ brew list --cask | grep emacs ; echo $?
1
$ echo 'cask "emacs"' | brew bundle install --verbose --file=-; echo $?
==> Downloading https://formulae.brew.sh/api/cask.jws.json
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1047k 100 1047k 0 0 3169k 0 --:--:-- --:--:-- --:--:-- 3446k
Installing emacs
Installing emacs cask. It is not currently installed.
==> Downloading https://emacsformacosx.com/emacs-builds/Emacs-29.1-1-universal.d
Already downloaded: /Users/ichamberlain/Library/Caches/Homebrew/downloads/bc7dcf972996173def825339282d91fd01e6a66a1448b5b37ec126d4500c561f--Emacs-29.1-1-universal.dmg
==> Installing Cask emacs
==> Purging files for version 29.1-1 of Cask emacs
Error: It seems there is already an App at '/Applications/Emacs.app'.
Installing emacs has failed!
Homebrew Bundle failed! 1 Brewfile dependency failed to install.
1
brew bundle check
appears unaffected, it reports brew bundle can't satisfy your Brewfile's dependencies.
whether run with --verbose
or not.
Edit: possibly introduced by fe11409 ?
@brew(main):008:1* IO.popen(["sh", "-c", "exit 1"], err: [:child, :out]) do |pipe|
@brew(main):009:1* Process.wait(pipe.pid)
@brew(main):010:1* success = $CHILD_STATUS.dup.success?
@brew(main):011:1* pipe.close
@brew(main):012:0> end
=> nil
@brew(main):013:0> success
=> true
@brew(main):014:0>
I can report the same symptoms - brew bundle
reports a successful install although one of the packages failed to install for completely unrelated reasons. Manual brew install
fails properoy.
I expect this should now be resolved. Please verify and respond if not!
Confirmed, after a brew update
it seems to be failing as expected, without --verbose
:
$ echo 'cask "emacs"' | brew bundle install --file=-; echo $?
Installing emacs
==> Downloading https://emacsformacosx.com/emacs-builds/Emacs-29.1-1-universal.dmg
Already downloaded: /Users/ichamberlain/Library/Caches/Homebrew/downloads/bc7dcf972996173def825339282d91fd01e6a66a1448b5b37ec126d4500c561f--Emacs-29.1-1-universal.dmg
==> Installing Cask emacs
Error: It seems there is already an App at '/Applications/Emacs.app'.
==> Purging files for version 29.1-1 of Cask emacs
Installing emacs has failed!
Homebrew Bundle failed! 1 Brewfile dependency failed to install.
1
Thanks!
Please verify
Verified this issue is fixed (tested on Homebrew 4.2.2-29-gb3751bc). 🎉
@ian-h-chamberlain @weakish thanks for reporting back, really helpful 🙇🏻