brew icon indicating copy to clipboard operation
brew copied to clipboard

brew upgrade can actually downgrade casks in some configurations

Open Frizlab opened this issue 1 year ago • 4 comments

brew doctor output

Your system is ready to brew.

Verification

  • [X] My "brew doctor output" above says Your system is ready to brew. and am still able to reproduce my issue.
  • [X] I ran brew update twice and am still able to reproduce my issue.
  • [X] 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.3
ORIGIN: https://github.com/Homebrew/brew
HEAD: e130e47f23b8b806096f9ec4f2c193213b8ec908
Last commit: 2 days ago
Core tap JSON: 04 Jun 19:20 UTC
Core cask tap JSON: 04 Jun 19:20 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: ["--skip-cask-deps", "--no-binaries", "--appdir=/Applications", "--colorpickerdir=/Library/ColorPickers", "--prefpanedir=/Library/PreferencePanes", "--qlplugindir=/Library/QuickLook", "--mdimporterdir=/Library/Spotlight", "--dictionarydir=/Library/Dictionaries", "--fontdir=/Library/Fonts", "--servicedir=/Library/Services", "--input_methoddir=/Library/Input Methods", "--internet_plugindir=/Library/Internet Plug-Ins", "--audio_unit_plugindir=/Library/Audio/Plug-Ins/Components", "--vst_plugindir=/Library/Audio/Plug-Ins/VST", "--vst3_plugindir=/Library/Audio/Plug-Ins/VST3", "--screen_saverdir=/Library/Screen Savers"]
HOMEBREW_DISPLAY_INSTALL_TIMES: set
HOMEBREW_EDITOR: vi
HOMEBREW_GITHUB_API_TOKEN: set
HOMEBREW_MAKE_JOBS: 8
HOMEBREW_NO_ANALYTICS: set
HOMEBREW_NO_AUTO_UPDATE: set
HOMEBREW_NO_INSTALL_CLEANUP: set
Homebrew Ruby: 3.3.2 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.2/bin/ruby
CPU: octa-core 64-bit dunno
Clang: 15.0.0 build 1500
Git: 2.39.3 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 8.6.0 => /usr/bin/curl
macOS: 14.5-arm64
CLT: 15.3.0.0.1.1708646388
Xcode: 15.4 => /Applications/Xcode-15.4.0.app/Contents/Developer
Rosetta 2: false

What were you trying to do (and why)?

I’m trying to upgrade a cask which has been release in two of the taps on my system and have different versions on the two taps.

What happened (include all command output)?

42sh$ brew upgrade
==> Casks with 'auto_updates true' or 'version :latest' will not be upgraded; pass `--greedy` to upgrade them.
==> Upgrading 1 outdated package:
happn-app/public/locmapper-app 1.4.0 -> 1.3.7
==> Upgrading locmapper-app
==> Downloading https://github.com/happn-app/LocMapper/releases/download/LocMapper%2Frelease%2F1.3.7/LocMapperApp.zip
==> Downloading from https://objects.githubusercontent.com/github-production-release-asset-2e65be/86438845/30808848-e72c-4872-ab47-3aed127ecaed?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=releaseassetproduction%2F20240604%2Fus-east-1%2F
########################################################################################################################################################################################################################################### 100.0%
==> Backing App 'LocMapper.app' up to '/opt/homebrew/Caskroom/locmapper-app/1.4.0/LocMapper.app'
==> Removing App '/Applications/LocMapper.app'
Warning: Your terminal does not have App Management permissions, so Homebrew will delete and reinstall the app.
This may result in some configurations (like notification settings or location in the Dock/Launchpad) being lost.
To fix this, go to System Settings > Privacy & Security > App Management and add or enable your terminal.
==> Moving App 'LocMapper.app' to '/Applications/LocMapper.app'
==> Purging files for version 1.4.0 of Cask locmapper-app
🍺  locmapper-app was successfully upgraded!
==> Installation times
locmapper-app             1.764 s

Note we can see the cask happn-app/public/locmapper-app is being upgraded but I initially installed frizlab/perso/locmapper-app.

What did you expect to happen?

I expected the cask to stay at the same version.

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

brew install frizlab/perso/locmapper-app
brew tap happn-app/public
brew upgrade

Frizlab avatar Jun 04 '24 21:06 Frizlab

Casks don't really track what tap they came from at the moment. I agree this should be fixed, though will likely require addressing https://github.com/Homebrew/brew/issues/17013.

Bo98 avatar Jun 04 '24 22:06 Bo98

At the very least would it be possible to actually compare the version number before happily downgrading an app?

Frizlab avatar Jun 05 '24 14:06 Frizlab

Casks also don't do semver comparisons. It's a simple not-equals comparison.

Bo98 avatar Jun 05 '24 14:06 Bo98

Unfortunate, but ok.

Frizlab avatar Jun 05 '24 14:06 Frizlab

@Rylan12 I assume this can be closed now that https://github.com/Homebrew/brew/pull/17823 has been merged in, right?

apainintheneck avatar Oct 15 '24 05:10 apainintheneck

Yes, I think this should be good now!

Note: you might need to reinstall any problematic casks as a one-time fix (simply brew reinstall should be enough), but moving forward this should not be a problem.

Rylan12 avatar Oct 15 '24 06:10 Rylan12