Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reinstall happening even when downloaded artifact is the same #17352

Closed
3 tasks done
trss opened this issue May 23, 2024 · 8 comments
Closed
3 tasks done

Reinstall happening even when downloaded artifact is the same #17352

trss opened this issue May 23, 2024 · 8 comments
Labels
bug Reproducible Homebrew/brew bug outdated PR was locked due to age

Comments

@trss
Copy link

trss commented May 23, 2024

brew doctor output

Your system is ready to brew.

Verification

  • My "brew doctor output" above says Your system is ready to brew. and am still able to reproduce my issue.
  • I ran brew update twice and am still able to reproduce my issue.
  • This issue's title and/or description do not reference a single formula e.g. brew install wget. If they do, open an issue at https://github.com/Homebrew/homebrew-core/issues/new/choose instead.

brew config output

HOMEBREW_VERSION: 4.3.1
ORIGIN: https://github.com/Homebrew/brew
HEAD: e0bc557e7b991cb23583679e1cf1c8a92b793aeb
Last commit: 3 days ago
Core tap JSON: 23 May 06:58 UTC
Core cask tap JSON: 23 May 06:58 UTC
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_EDITOR: subl -w
HOMEBREW_MAKE_JOBS: 8
Homebrew Ruby: 3.3.1 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.1/bin/ruby
CPU: octa-core 64-bit kabylake
Clang: 15.0.0 build 1500
Git: 2.45.1 => /usr/local/bin/git
Curl: 8.4.0 => /usr/bin/curl
macOS: 13.6.7-x86_64
CLT: 15.1.0.0.1.1700200546
Xcode: 15.1

What were you trying to do (and why)?

To keep chromium up to date, I did brew upgrade chromium when brew outdated --greedy listed chromium. But despite no upgrade needed which is evident from the warning that the downloaded artifact has not changed, it reinstalls chromium.

What happened (include all command output)?

$ brew outdated --greedy
==> Downloading https://formulae.brew.sh/api/formula.jws.json
############################################################## 100.0%
==> Downloading https://formulae.brew.sh/api/cask.jws.json
############################################################## 100.0%
chromium (latest) != latest
$ brew upgrade chromium
==> Upgrading 1 outdated package:
chromium latest -> latest
==> Upgrading chromium
==> Downloading https://raw.githubusercontent.com/Homebrew/homebrew-c
############################################################## 100.0%
==> Downloading https://download-chromium.appspot.com/dl/Mac?type=sna
Already downloaded: /Users/trss/Library/Caches/Homebrew/downloads/959aaf9ee2437d2161a6e3dd2443d23583f7a4569a3d5cda19ac82d9e02bc442--chrome-mac.zip
Warning: No checksum defined for cask 'chromium', skipping verification.
==> Backing App 'Chromium.app' up to '/usr/local/Caskroom/chromium/la
==> Removing App '/Applications/Chromium.app'
==> Unlinking Binary '/usr/local/bin/chromium'
==> Moving App 'Chromium.app' to '/Applications/Chromium.app'
==> Linking Binary 'chromium.wrapper.sh' to '/usr/local/bin/chromium'
==> Purging files for version latest of Cask chromium
🍺  chromium was successfully upgraded!
$ brew outdated --greedy
$ brew upgrade chromium
Warning: Not upgrading chromium, the downloaded artifact has not changed

After 10 mins:

$ brew outdated --greedy
==> Downloading https://formulae.brew.sh/api/formula.jws.json
############################################################## 100.0%
==> Downloading https://formulae.brew.sh/api/cask.jws.json
############################################################## 100.0%
$ brew upgrade chromium
Warning: Not upgrading chromium, the downloaded artifact has not changed

After about an hour:

$ brew outdated --greedy
==> Downloading https://formulae.brew.sh/api/formula.jws.json
############################################################## 100.0%
==> Downloading https://formulae.brew.sh/api/cask.jws.json
############################################################## 100.0%
chromium (latest) != latest
$ brew upgrade chromium
==> Upgrading 1 outdated package:
chromium latest -> latest
==> Upgrading chromium
==> Downloading https://raw.githubusercontent.com/Homebrew/homebrew-c
############################################################## 100.0%
==> Downloading https://download-chromium.appspot.com/dl/Mac?type=sna
Already downloaded: /Users/trss/Library/Caches/Homebrew/downloads/959aaf9ee2437d2161a6e3dd2443d23583f7a4569a3d5cda19ac82d9e02bc442--chrome-mac.zip
Warning: No checksum defined for cask 'chromium', skipping verification.
==> Backing App 'Chromium.app' up to '/usr/local/Caskroom/chromium/la
==> Removing App '/Applications/Chromium.app'
==> Unlinking Binary '/usr/local/bin/chromium'
==> Moving App 'Chromium.app' to '/Applications/Chromium.app'
==> Linking Binary 'chromium.wrapper.sh' to '/usr/local/bin/chromium'
==> Purging files for version latest of Cask chromium
🍺  chromium was successfully upgraded!

What did you expect to happen?

Chromium never gets reinstalled since the downloaded artifact never changed.

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

  1. brew install chromium
  2. brew outdated --greedy
  3. brew upgrade chromium
  4. Wait until brew outdated --greedy lists chromium which for me takes between half to one hour.
  5. brew upgrade chromium
@trss trss added the bug Reproducible Homebrew/brew bug label May 23, 2024
@trss
Copy link
Author

trss commented May 23, 2024

Created this issue based on the suggestion at Homebrew/homebrew-cask#170127 (comment):

You could file that with the brew tool to see if it's consider a bug.

@bevanjkay
Copy link
Member

@trss Are you sure this isn't because there is actually a newer version available after some time? Upstream sometimes updates the app multiple times within an hour.

@trss
Copy link
Author

trss commented May 23, 2024

It wouldn't say it's already downloaded in that case is what I'm thinking.

@bevanjkay
Copy link
Member

I can't say for sure how long the cache lasts for the brew outdated and brew upgrade commands (I would need to do some further digging).
But the binary is being downloaded and cached when you run brew outdated --greedy, and then brew upgrade chromium installs the cached file if it is indeed different to what is currently installed.

@trss
Copy link
Author

trss commented May 23, 2024

Oh, I was completely unaware that brew outdated --greedy would download and cache the binary! Let me verify this as well as whether the cached file indeed changed and get back with my observations over the next few hours.

@bevanjkay
Copy link
Member

If you run brew outdated --greedy --debug you will be able to see exactly what actions it is taking.

@trss
Copy link
Author

trss commented May 23, 2024

Thanks, that's right!

I do see the following:

/usr/bin/env /usr/local/Homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --show-error --user-agent Homebrew/4.3.1\ \(Macintosh\;\ Intel\ Mac\ OS\ X\ 13.6.7\)\ curl/8.4.0 --header Accept-Language:\ en --retry 3 --fail --location --silent --head https://download-chromium.appspot.com/dl/Mac\?type=snapshots
/usr/bin/env /usr/local/Homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --show-error --user-agent Homebrew/4.3.1\ \(Macintosh\;\ Intel\ Mac\ OS\ X\ 13.6.7\)\ curl/8.4.0 --header Accept-Language:\ en --retry 3 --fail --location --silent --head --request GET https://download-chromium.appspot.com/dl/Mac\?type=snapshots

However, two suggestive observations:

  1. The contents of chrome://version didn't change.
  2. The location mentioned in Already downloaded: /Users/trss/Library/Caches/Homebrew/downloads/959aaf9ee2437d2161a6e3dd2443d23583f7a4569a3d5cda19ac82d9e02bc442--chrome-mac.zip hasn't changed across many reinstalls.

Looking forward to know from you whether the second one can be considered conclusive assuming you know how the caching works, specifically the generation of the cache file name.

@trss
Copy link
Author

trss commented May 23, 2024

Obvious next step was to make a copy of the binary and compare with the newly downloaded one and they differ! Also, the created/modified timestamp of the file jumps each time it downloads (during brew outdated!). So now I have a more or less definitive answer to your question.

@trss Are you sure this isn't because there is actually a newer version available after some time? Upstream sometimes updates the app multiple times within an hour.

This in fact is because of a newer version being available! :) Thank you.

@trss trss closed this as completed May 23, 2024
@github-actions github-actions bot added the outdated PR was locked due to age label Jun 23, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Reproducible Homebrew/brew bug outdated PR was locked due to age
Projects
None yet
Development

No branches or pull requests

2 participants