Homebrew / brew

🍺 The missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
41.02k stars 9.63k forks source link

brew update constantly updating taps after cleanup --prune 0 #15217

Closed ghost closed 1 year ago

ghost commented 1 year ago

brew doctor output

~ % brew doctor
Your system is ready to brew.
~ %

Verification

brew config output

~ % brew config
HOMEBREW_VERSION: 4.0.13
ORIGIN: https://github.com/Homebrew/brew
HEAD: 9b60fcf7ac3f82fa589a64091376d0663262f8c6
Last commit: 9 hours ago
Core tap origin: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 1679db963e5c9a033ea4cbb4dab3d56f13021d31
Core tap last commit: 8 weeks ago
Core tap branch: master
Core tap JSON: 13 Apr 03:31 UTC
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_EDITOR: emacs
HOMEBREW_MAKE_JOBS: 12
Homebrew Ruby: 2.6.10 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: dodeca-core 64-bit kabylake
Clang: 14.0.0 build 1400
Git: 2.40.0 => /usr/local/bin/git
Curl: 7.87.0 => /usr/bin/curl
macOS: 12.6.5-x86_64
CLT: 14.2.0.0.1.1668646533
Xcode: 14.2
~ %

What were you trying to do (and why)?

I always run a somewhat aggressive brew cleanup after brew update and/or brew upgrade:

brew update brew cleanup -s --prune 0

As of not too long ago, cleanup seems to do something causing a subsequent brew update to list updated taps again. This is more of a minor annoyance, but it didn't happen until fairly recently, so I am curious as to what changed and reporting just in case there actually might be unexpected behavior / a bug somewhere.

What happened (include all command output)?

~ % brew update
Updated 2 taps (homebrew/core and homebrew/cask).
==> New Formulae
form                     hck                      sad                      vvdec                    vvenc
==> New Casks
bluos-controller               elgato-stream-deck             logitech-g-hub                 ubiquiti-unifi-controller
canon-eos-utility              elgato-video-capture           logitech-options               yubico-yubikey-manager
corsair-icue                   elgato-wave-link               sony-ps-remote-play
displaylink                    logitech-camera-settings       toshiba-color-mfp
~ % brew update
Already up-to-date.
~ % brew cleanup --prune 0
Removing: /Users/tim/Library/Caches/Homebrew/external_commands_list.txt... (75B)
Removing: /Users/tim/Library/Caches/Homebrew/all_commands_list.txt... (1KB)
==> This operation has freed approximately 1.2KB of disk space.
~ % brew update
Updated 2 taps (homebrew/core and homebrew/cask).
==> New Formulae
form                     hck                      sad                      vvdec                    vvenc
==> New Casks
bluos-controller               elgato-stream-deck             logitech-g-hub                 ubiquiti-unifi-controller
canon-eos-utility              elgato-video-capture           logitech-options               yubico-yubikey-manager
corsair-icue                   elgato-wave-link               sony-ps-remote-play
displaylink                    logitech-camera-settings       toshiba-color-mfp
~ %

What did you expect to happen?

~ % brew update
Updated 2 taps (homebrew/core and homebrew/cask).
==> New Formulae
form                     hck                      sad                      vvdec                    vvenc
==> New Casks
bluos-controller               elgato-stream-deck             logitech-g-hub                 ubiquiti-unifi-controller
canon-eos-utility              elgato-video-capture           logitech-options               yubico-yubikey-manager
corsair-icue                   elgato-wave-link               sony-ps-remote-play
displaylink                    logitech-camera-settings       toshiba-color-mfp
~ % brew update
Already up-to-date.
~ % brew cleanup --prune 0
Removing: /Users/tim/Library/Caches/Homebrew/external_commands_list.txt... (75B)
Removing: /Users/tim/Library/Caches/Homebrew/all_commands_list.txt... (1KB)
==> This operation has freed approximately 1.2KB of disk space.
~ % brew update
Already up-to-date.
~ %

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

See above.
MikeMcQuaid commented 1 year ago

~ % brew cleanup --prune 0 Removing: /Users/tim/Library/Caches/Homebrew/external_commands_list.txt... (75B) Removing: /Users/tim/Library/Caches/Homebrew/all_commands_list.txt... (1KB)

This is why. Until it's fixed: don't do that.


I guess the decision for maintainers here is: 1) do we prevent these files from being cleaned up on --prune=0? 2) do we better handle what happens when these files are not present?

ghost commented 1 year ago

Just FWIW, those two files have been removed by --prune=0 for as long as I can remember (the shell function I use to update then cleanup specifically greps them out from the output), but the fact that brew update does not "recognize" it is up-to-date after removing those two files is more recent? I used to be able to run my function and it printed "Already up-to-date." on the second call, instead of updating again.

carlocab commented 1 year ago

If you change the command you run to brew cleanup --prune=1, then you'll stop having this problem. (As long as it's run only immediately after brew update.)

ghost commented 1 year ago

Thanks, I've already done that before reporting.

I used to be able to run my function and it printed "Already up-to-date." on the second call, instead of updating again.

Am I going crazy here? I'm not sure how to go about bisecting something like this, is there a way to e.g. roll back the core to some older version and use brew update to only update the lists and formulae/casks but not the rest of brew itself?

ghost commented 1 year ago

Did you guys change something? It seems to behave like it used to again:

% brew update; brew upgrade; brew cleanup -s --prune=0; brew update; brew cleanup -s --prune=0; brew update
Already up-to-date.
Removing: /Users/tim/Library/Caches/Homebrew/external_commands_list.txt... (75B)
Removing: /Users/tim/Library/Caches/Homebrew/all_commands_list.txt... (1KB)
==> This operation has freed approximately 1.2KB of disk space.
Already up-to-date.
Removing: /Users/tim/Library/Caches/Homebrew/external_commands_list.txt... (75B)
Removing: /Users/tim/Library/Caches/Homebrew/all_commands_list.txt... (1KB)
==> This operation has freed approximately 1.2KB of disk space.
Already up-to-date.
%

No more re-listing new casks and formulae even after --prune=0

MikeMcQuaid commented 1 year ago

@Rodeo314 nothing changed here recently!

ghost commented 1 year ago

But it makes no sense???

Removing: /Users/tim/Library/Caches/Homebrew/external_commands_list.txt... (75B)
Removing: /Users/tim/Library/Caches/Homebrew/all_commands_list.txt... (1KB)
==> This operation has freed approximately 1.2KB of disk space.

…must not have been the cause of my issue then?

ghost commented 1 year ago

Either way, I feel like I wasted enough of your time. Feel free to close this if you like.

Bo98 commented 1 year ago

I had a look at this and I don't think brew cleanup has anything to do with this.

After https://github.com/Homebrew/brew/commit/9de0b619f3eed6e4753c156d0c6ed04b782c4687, brew update-report will always report Homebrew/core and Homebrew/cask as updated until the next time the JSON changes*, because the diff between before and after always remains different. This seems to be intentional? Though I find the behaviour a little confusing, particularly given git taps don't behave the same way.

* technically it's until the filesize changes, and many version bumps don't actually change the size of the overall JSON - so the state can stick for hours.

MikeMcQuaid commented 1 year ago

because the diff between before and after always remains different. This seems to be intentional?

This is not intentional 😅

ghost commented 1 year ago

That would explain what I've experienced, I think, and the timing is about right around when I noticed it, if memory serves me correctly.