Homebrew / homebrew-cask

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

Onyx 4.3.5 SHA256 mismatch error on macOS 13.2 #140273

Closed gbstan closed 1 year ago

gbstan commented 1 year ago

Verification

Description of issue

I know this is a checksum does not match error. I have checked the version numbers on brew cask and on the website of the application and they are the same. I have tried to do an update of the cask via https://docs.brew.sh/Common-Issues#cask---checksum-does-not-match but got stuck. I would be grateful if someone could help.

The command brew install --cask onyx produces the following output:

Error: SHA256 mismatch
Expected: dd8c81e30a03f3e4cdcbc015d9207b6036bd40200dc51528dfe5d3d32817e3a3
  Actual: 5d4bd7ca16fbd2bd70a383f74e6c254d281776ae0a012d1484c392cc4dc5ee28

Command that failed

brew install --cask onyx

Output of command with --verbose --debug

/usr/local/Homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --show-error --user-agent Homebrew/3.6.20-143-g10845a1\ \(Macintosh\;\ Intel\ Mac\ OS\ X\ 13.2\)\ curl/7.86.0 --header Accept-Language:\ en --fail --max-time 5 --retry 3 --location --remote-time --output /Users/guy-bartstan/Library/Caches/Homebrew/api/formula.json --time-cond /Users/guy-bartstan/Library/Caches/Homebrew/api/formula.json --compressed --silent https://formulae.brew.sh/api/formula.json
/usr/local/Homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --show-error --user-agent Homebrew/3.6.20-143-g10845a1\ \(Macintosh\;\ Intel\ Mac\ OS\ X\ 13.2\)\ curl/7.86.0 --header Accept-Language:\ en --max-time 5 --retry 3 --fail https://formulae.brew.sh/api/cask-source/onyx.rb
/usr/local/Homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --show-error --user-agent Homebrew/3.6.20-143-g10845a1\ \(Macintosh\;\ Intel\ Mac\ OS\ X\ 13.2\)\ curl/7.86.0 --header Accept-Language:\ en --fail --max-time 5 --retry 3 --location --remote-time --output /Users/guy-bartstan/Library/Caches/Homebrew/api/cask.json --time-cond /Users/guy-bartstan/Library/Caches/Homebrew/api/cask.json --compressed --silent https://formulae.brew.sh/api/cask.json
==> Cask::Installer#install
==> Printing caveats
==> Cask::Installer#fetch
==> Downloading https://www.titanium-software.fr/download/12/OnyX.dmg
/usr/local/Homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --show-error --user-agent Homebrew/3.6.20-143-g10845a1\ \(Macintosh\;\ Intel\ Mac\ OS\ X\ 13.2\)\ curl/7.86.0 --header Accept-Language:\ en --retry 3 --location --silent --head --request GET https://www.titanium-software.fr/download/12/OnyX.dmg
Already downloaded: /Users/guy-bartstan/Library/Caches/Homebrew/downloads/750069d93a61822d8d38e45c15105350c6573e218297078827c5f45f92dd72c8--OnyX.dmg
==> Checking quarantine support
/usr/bin/xattr -h
/usr/bin/swift -target x86_64-apple-macosx13 /usr/local/Homebrew/Library/Homebrew/cask/utils/quarantine.swift
==> Unknown support status
==> Verifying checksum for cask 'onyx'
Error: SHA256 mismatch
Expected: dd8c81e30a03f3e4cdcbc015d9207b6036bd40200dc51528dfe5d3d32817e3a3
  Actual: 5d4bd7ca16fbd2bd70a383f74e6c254d281776ae0a012d1484c392cc4dc5ee28
    File: /Users/guy-bartstan/Library/Caches/Homebrew/downloads/750069d93a61822d8d38e45c15105350c6573e218297078827c5f45f92dd72c8--OnyX.dmg
To retry an incomplete download, remove the file above.
/usr/local/Homebrew/Library/Homebrew/extend/pathname.rb:292:in `verify_checksum'
/usr/local/Homebrew/Library/Homebrew/cask/download.rb:68:in `verify_download_integrity'
/usr/local/Homebrew/Library/Homebrew/cask/download.rb:33:in `fetch'
/usr/local/Homebrew/Library/Homebrew/cask/installer.rb:179:in `download'
/usr/local/Homebrew/Library/Homebrew/cask/installer.rb:69:in `fetch'
/usr/local/Homebrew/Library/Homebrew/cask/installer.rb:100:in `install'
/usr/local/Homebrew/Library/Homebrew/cask/cmd/install.rb:112:in `block in install_casks'
/usr/local/Homebrew/Library/Homebrew/cask/cmd/install.rb:111:in `each'
/usr/local/Homebrew/Library/Homebrew/cask/cmd/install.rb:111:in `install_casks'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:185:in `install'
/usr/local/Homebrew/Library/Homebrew/brew.rb:105:in `<main>'

Output of brew doctor and brew config

HOMEBREW_VERSION: 3.6.20-143-g10845a1
ORIGIN: https://github.com/Homebrew/brew
HEAD: 10845a1122b916dc91d04f00a4d8b7b888d52654
Last commit: 5 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 2f8402077e43a4ed1df283196f6bedcd6566a194
Core tap last commit: 24 hours ago
Core tap branch: master
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.Eq80j4VZ5c/org.xquartz:0
HOMEBREW_EDITOR: subl -n -w
HOMEBREW_GITHUB_API_TOKEN: set
HOMEBREW_INSTALL_FROM_API: set
HOMEBREW_MAKE_JOBS: 10
Homebrew Ruby: 2.6.10 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: 10-core 64-bit westmere
Clang: N/A
Git: 2.39.1 => /usr/local/bin/git
Curl: 7.86.0 => /usr/bin/curl
macOS: 13.2-x86_64
CLT: N/A
Xcode: N/A
Rosetta 2: true

Output of brew tap

beeftornado/rmtree
federico-terzi/espanso
homebrew/cask
homebrew/cask-fonts
homebrew/cask-versions
homebrew/core
ms-jpq/sad
saulpw/vd
tankerhq/repo
zdcthomas/tools
SMillerDev commented 1 year ago

but got stuck

What did you get stuck on?

gbstan commented 1 year ago

When I executed brew bump-cask-pr --version 4.3.5 onyx, this is what I got:

brew bump-cask-pr --version 4.3.5 onyx
Running `brew update --auto-update`...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> New Formulae
clang-build-analyzer                                                                                                                xcdiff
==> New Casks
rive

==> Installing 'bundler' gem
Fetching bundler-2.3.26.gem
Ignoring bootsnap-1.13.0 because its extensions are not built. Try: gem pristine bootsnap --version 1.13.0
Ignoring byebug-11.1.3 because its extensions are not built. Try: gem pristine byebug --version 11.1.3
Ignoring hpricot-0.8.6 because its extensions are not built. Try: gem pristine hpricot --version 0.8.6
Ignoring json-2.6.2 because its extensions are not built. Try: gem pristine json --version 2.6.2
Ignoring msgpack-1.5.6 because its extensions are not built. Try: gem pristine msgpack --version 1.5.6
Ignoring racc-1.6.0 because its extensions are not built. Try: gem pristine racc --version 1.6.0
Ignoring rdiscount-2.2.0.2 because its extensions are not built. Try: gem pristine rdiscount --version 2.2.0.2
Ignoring unf_ext-0.0.8.2 because its extensions are not built. Try: gem pristine unf_ext --version 0.0.8.2
Ignoring bootsnap-1.13.0 because its extensions are not built. Try: gem pristine bootsnap --version 1.13.0
Ignoring byebug-11.1.3 because its extensions are not built. Try: gem pristine byebug --version 11.1.3
Ignoring hpricot-0.8.6 because its extensions are not built. Try: gem pristine hpricot --version 0.8.6
Ignoring json-2.6.2 because its extensions are not built. Try: gem pristine json --version 2.6.2
Ignoring msgpack-1.5.6 because its extensions are not built. Try: gem pristine msgpack --version 1.5.6
Ignoring racc-1.6.0 because its extensions are not built. Try: gem pristine racc --version 1.6.0
Ignoring rdiscount-2.2.0.2 because its extensions are not built. Try: gem pristine rdiscount --version 2.2.0.2
Ignoring unf_ext-0.0.8.2 because its extensions are not built. Try: gem pristine unf_ext --version 0.0.8.2
Fetching gem metadata from https://rubygems.org/.......
Fetching minitest 5.17.0
Fetching concurrent-ruby 1.2.0
Fetching zeitwerk 2.6.6
Fetching public_suffix 5.0.1
Installing zeitwerk 2.6.6
Installing minitest 5.17.0
Installing public_suffix 5.0.1
Installing concurrent-ruby 1.2.0
Using ast 2.4.2
Fetching bindata 2.4.14
Fetching msgpack 1.6.0
Using bundler 2.3.26
Installing byebug 11.1.3 with native extensions
Installing bindata 2.4.14
Installing msgpack 1.6.0 with native extensions
Fetching connection_pool 2.3.0
Installing connection_pool 2.3.0
Fetching did_you_mean 1.6.3
Installing did_you_mean 1.6.3
Using diff-lcs 1.5.0
Using docile 1.4.0
Installing unf_ext 0.0.8.2 with native extensions
Fetching regexp_parser 2.6.2
Installing regexp_parser 2.6.2
Using hana 1.3.7
Installing hpricot 0.8.6 with native extensions
Fetching json 2.6.3
Installing json 2.6.3 with native extensions
Using uri_template 0.7.0
Using mime-types-data 3.2022.0105
Using net-http-digest_auth 1.4.1
Fetching racc 1.6.2
Installing racc 1.6.2 with native extensions
Using rubyntlm 0.6.3
Using webrick 1.7.0
Using webrobots 0.1.2
Fetching method_source 1.0.0
Installing method_source 1.0.0
Using mustache 1.1.1
Using parallel 1.22.1
Using plist 3.6.0
Fetching rack 3.0.4.1
Installing rack 3.0.4.1
Using rainbow 3.1.1
Fetching rdiscount 2.2.7
Installing rdiscount 2.2.7 with native extensions
Using rexml 3.2.5
Fetching rspec-support 3.12.0
Installing rspec-support 3.12.0
Fetching sorbet-runtime 0.5.10461
Installing sorbet-runtime 0.5.10461
Using ruby-progressbar 1.11.0
Fetching unicode-display_width 2.4.2
Installing unicode-display_width 2.4.2
Using ruby-macho 3.0.0
Using simplecov-html 0.12.3
Using simplecov_json_formatter 0.1.4
Using warning 1.3.0
Fetching parser 3.2.0.0
Installing parser 3.2.0.0
Using addressable 2.8.1
Fetching elftools 1.2.0
Installing elftools 1.2.0
Using net-http-persistent 4.0.1
Using i18n 1.12.0
Using tzinfo 2.0.5
Using ecma-re-validator 0.4.0
Fetching bootsnap 1.16.0
Installing bootsnap 1.16.0 with native extensions
Using mime-types 3.4.1
Using unf 0.1.4
Fetching parallel_tests 3.13.0
Installing parallel_tests 3.13.0
Fetching nokogiri 1.13.10 (x86_64-darwin)
Installing nokogiri 1.13.10 (x86_64-darwin)
Fetching rspec-core 3.12.0
Installing rspec-core 3.12.0
Fetching rspec-expectations 3.12.2
Installing rspec-expectations 3.12.2
Fetching rspec-mocks 3.12.3
Installing rspec-mocks 3.12.3
Fetching rspec-sorbet 1.9.1
Installing rspec-sorbet 1.9.1
Fetching simplecov 0.22.0
Installing simplecov 0.22.0
Fetching rubocop-ast 1.24.1
Installing rubocop-ast 1.24.1
Fetching patchelf 1.4.0
Installing patchelf 1.4.0
Fetching activesupport 6.1.7.2
Installing activesupport 6.1.7.2
Fetching json_schemer 0.2.24
Installing json_schemer 0.2.24
Using domain_name 0.5.20190701
Fetching rspec-github 2.4.0
Installing rspec-github 2.4.0
Using rspec-retry 0.6.2
Fetching rspec_junit_formatter 0.6.0
Installing rspec_junit_formatter 0.6.0
Using rspec-its 1.3.0
Fetching rspec 3.12.0
Installing rspec 3.12.0
Using simplecov-cobertura 2.1.0
Using http-cookie 1.0.5
Using mechanize 2.8.5
Using ronn 0.7.3
Fetching rubocop 1.44.1
Installing rubocop 1.44.1
Fetching rubocop-capybara 2.17.0
Fetching rubocop-performance 1.15.2
Fetching rubocop-rails 2.17.4
Using rubocop-sorbet 0.6.11
Installing rubocop-capybara 2.17.0
Installing rubocop-performance 1.15.2
Installing rubocop-rails 2.17.4
Fetching rubocop-rspec 2.18.1
Installing rubocop-rspec 2.18.1
Bundle complete! 35 Gemfile dependencies, 78 gems now installed.
Bundled gems are installed into `../../usr/local/Homebrew/Library/Homebrew/vendor/bundle`
Removing nokogiri-1.13.8-x86_64 (darwin)
Removing rspec-mocks (3.11.1)
Removing regexp_parser (2.5.0)
Removing rspec-wait (0.0.9)
Removing rubocop-performance (1.14.3)
Removing activesupport (6.1.6.1)
Removing mini_portile2 (2.8.0)
Removing parser (3.1.2.1)
Removing elftools (1.1.3)
Removing rspec-sorbet (1.8.3)
Removing simplecov (0.21.2)
Removing patchelf (1.3.0)
Removing json (2.6.2)
Removing rubocop (1.35.1)
Removing minitest (5.16.3)
Removing rubocop-rails (2.15.2)
Removing did_you_mean (1.6.1)
Removing public_suffix (5.0.0)
Removing rspec-core (3.11.0)
Removing rspec-support (3.11.0)
Removing rubocop-ast (1.21.0)
Removing rspec-github (2.3.1)
Removing json_schemer (0.2.21)
Removing racc (1.6.0)
Removing bindata (2.4.10)
Removing rspec-expectations (3.11.0)
Removing unicode-display_width (2.2.0)
Removing parallel_tests (3.12.0)
Removing zeitwerk (2.6.0)
Removing concurrent-ruby (1.1.10)
Removing connection_pool (2.2.5)
Removing rspec (3.11.0)
Removing rdiscount (2.2.0.2)
Removing rack (2.2.4)
Removing bootsnap (1.13.0)
Removing rubocop-rspec (2.12.1)
Removing msgpack (1.5.6)
Removing rspec_junit_formatter (0.5.1)
Error: These closed pull requests may be duplicates:
Update onyx from 4.3.4 to 4.3.5 https://github.com/Homebrew/homebrew-cask/pull/138874
Duplicate PRs should not be opened. Use --force to override this error.
gbstan commented 1 year ago

Also, it seems that executing brew bump-cask-pr --version 4.3.5 onyx installs a bunch of things? Can these be removed afterwards? If so how?

miccal commented 1 year ago

I cannot reproduce this -- the current SHA256 is correct:

|-> brew fetch onyx
==> Downloading https://www.titanium-software.fr/download/13/OnyX.dmg
######################################################################## 100.0%
Downloaded to: /Users/miccal/Library/Caches/Homebrew/downloads/1e845f3072528cb592885d32deeb1bacc8929ddeb6bca2cfe191cc8a30d49d54--OnyX.dmg
SHA256: dd8c81e30a03f3e4cdcbc015d9207b6036bd40200dc51528dfe5d3d32817e3a3
rpendleton commented 1 year ago

I'm seeing this issue as well.

It's a bit odd, but it seems like even though I'm on macOS 13, Brew is trying to download the macOS 12 version of OnyX instead.

In @miccal's attempt to reproduce this issue, notice that the download URL includes 13. In the output for the original issue and my reproduction of the issue, however, the download URL incorrectly includes 12.

It's also worth noting that the actual hash we're seeing happens to match the expected hash in the formula file for the macOS 12 version (which makes sense, since that was the version that was downloaded). The expected hash for the install matches the macOS 13 hash from the formula though. So Brew at least knows we're on macOS 13 for validating the hash, but not for generating the download URL.

So, for some reason, #{MacOS.version.to_s.delete(".")} seems to be returning 12 for me and @gbstan even though we're on macOS 13, but it's properly returning 13 for @miccal.

Just confirming that I am, in fact, on macOS Ventura, and that Brew is up-to-date:

λ sw_vers
ProductName:        macOS
ProductVersion:     13.2
BuildVersion:       22D49

λ brew update
Already up-to-date.

λ brew --version
Homebrew 3.6.20-146-g4b3d64d
Homebrew/homebrew-core (git revision a02abf8819c; last commit 2023-01-28)
Homebrew/homebrew-cask (git revision 54fa92099c; last commit 2023-01-29)

Trying to upgrade:

λ brew upgrade onyx
==> Upgrading 1 outdated package:
onyx 4.3.5 -> 4.3.6
==> Upgrading onyx
==> Downloading https://www.titanium-software.fr/download/12/OnyX.dmg
######################################################################## 100.0%
==> Purging files for version 4.3.6 of Cask onyx
Error: onyx: SHA256 mismatch
Expected: dcf443b5585d85f8e5c03124a37a982c0885ff8826e33de93c6ffa60221bebc5
  Actual: 5d4bd7ca16fbd2bd70a383f74e6c254d281776ae0a012d1484c392cc4dc5ee28
    File: /Users/rpendleton/Library/Caches/Homebrew/downloads/750069d93a61822d8d38e45c15105350c6573e218297078827c5f45f92dd72c8--OnyX.dmg
To retry an incomplete download, remove the file above.

Trying to fetch after completely uninstalling OnyX:

λ brew fetch onyx
==> Downloading https://www.titanium-software.fr/download/12/OnyX.dmg
Already downloaded: /Users/rpendleton/Library/Caches/Homebrew/downloads/750069d93a61822d8d38e45c15105350c6573e218297078827c5f45f92dd72c8--OnyX.dmg
SHA256: 5d4bd7ca16fbd2bd70a383f74e6c254d281776ae0a012d1484c392cc4dc5ee28
Warning: Cask reports different sha256: dcf443b5585d85f8e5c03124a37a982c0885ff8826e33de93c6ffa60221bebc5
rpendleton commented 1 year ago

I've been digging a bit deeper, and I'm thinking this is related to HOMEBREW_INSTALL_FROM_API.

I found more details about this feature at homebrew/brew#13794, but it seems that one of the requirements of this feature is for formulas to move from using MacOS.Version to on_{system} blocks (#137512).

In the case of OnyX, that change was partially made in #137513. However, the formula still uses MacOS.Version in the download URL. I'm assuming that means the download URL is being determined by some Homebrew server, and that the server is currently running macOS 12.

I haven't intentionally enabled this feature for my Brew installation and don't see anything in my environment variables for it. It looks like the feature was recently enabled for "developers" by homebrew/brew#14384 though, and I've used developer commands in the past to check formulas, so I wonder if that's why I'm seeing the issue.

With all of that said, as you can see in the following examples, Brew uses a different download URL depending on whether I opt-out of this feature or not:

With feature enabled (by default it seems):

λ brew fetch onyx
==> Downloading https://www.titanium-software.fr/download/12/OnyX.dmg
######################################################################## 100.0%
Downloaded to: /Users/rpendleton/Library/Caches/Homebrew/downloads/750069d93a61822d8d38e45c15105350c6573e218297078827c5f45f92dd72c8--OnyX.dmg
SHA256: 5d4bd7ca16fbd2bd70a383f74e6c254d281776ae0a012d1484c392cc4dc5ee28
Warning: Cask reports different sha256: dcf443b5585d85f8e5c03124a37a982c0885ff8826e33de93c6ffa60221bebc5

With feature explicitly disabled:

λ HOMEBREW_NO_INSTALL_FROM_API=1 brew fetch onyx
==> Downloading https://www.titanium-software.fr/download/13/OnyX.dmg
######################################################################## 100.0%
Downloaded to: /Users/rpendleton/Library/Caches/Homebrew/downloads/1e845f3072528cb592885d32deeb1bacc8929ddeb6bca2cfe191cc8a30d49d54--OnyX.dmg
SHA256: dcf443b5585d85f8e5c03124a37a982c0885ff8826e33de93c6ffa60221bebc5

Is that something that this issue should be re-opened to fix, or does a new issue need to be created? It seems like this is something that should probably be fixed in the formula.

miccal commented 1 year ago

Ping @Rylan12.

alexreg commented 1 year ago

I have this exact same issue, except on macOS 13.1.

@rpendleton That doesn't seem to be the issue for me, oddly enough. HOMEBREW_NO_INSTALL_FROM_API=1 makes no difference, in fact.

$ brew fetch onyx
==> Downloading https://www.titanium-software.fr/download/12/OnyX.dmg
######################################################################## 100.0%
Downloaded to: /Library/Caches/Homebrew/downloads/750069d93a61822d8d38e45c15105350c6573e218297078827c5f45f92dd72c8--OnyX.dmg
SHA256: 5d4bd7ca16fbd2bd70a383f74e6c254d281776ae0a012d1484c392cc4dc5ee28
Warning: Cask reports different sha256: dcf443b5585d85f8e5c03124a37a982c0885ff8826e33de93c6ffa60221bebc5
$ HOMEBREW_NO_INSTALL_FROM_API=1 brew fetch onyx
==> Downloading https://www.titanium-software.fr/download/12/OnyX.dmg
######################################################################## 100.0%
Downloaded to: /Library/Caches/Homebrew/downloads/750069d93a61822d8d38e45c15105350c6573e218297078827c5f45f92dd72c8--OnyX.dmg
SHA256: 5d4bd7ca16fbd2bd70a383f74e6c254d281776ae0a012d1484c392cc4dc5ee28
Warning: Cask reports different sha256: dcf443b5585d85f8e5c03124a37a982c0885ff8826e33de93c6ffa60221bebc5
Rylan12 commented 1 year ago

This should now be fixed for real and should no longer need the HOMEBREW_NO_INSTALL_FROM_API variable to be set. Sorry for the inconvenience!

gbstan commented 1 year ago

Thanks this works with the following warning:

Warning: No checksum defined for cask 'onyx', skipping verification.
alexreg commented 1 year ago

I confirm this is now working for me too. Thank you.

Rylan12 commented 1 year ago

@gbstan that's okay, the checksums were removed along with the fix. You should be able to install the correct version now, and can safely ignore that message

gbstan commented 1 year ago

Cheers!