homebrew-cask icon indicating copy to clipboard operation
homebrew-cask copied to clipboard

Cask LuLu: problem with update logic

Open kevinm6 opened this issue 1 year ago • 11 comments

Verification

Description of issue

Like in previous issues about cask LuLu, there are some issues on upgrading the cask.

As reported from an Homebrew mantainer, brew upgrade <cask_name> runs brew uninstall <cask_name> && brew install <cask_name>.

From previous commit was added the uninstall script but then removed since it creates problem if running brew upgrade.

As reported from the cask mantainer the logic of upgrade and uninstall are really different for the cask, since the uninstall script run by the app on uninstall process removes files/rules on its own.

LuLu creator now has added support for different CLI-commands arguments like {-uninstall,-upgrade,-install} but it seems to me that they can’t be used since only a uninstall stanza is available for homebrew-casks.

Are there any workaround to avoid brew uninstall on brew upgrade or anything else in this case?

Command that failed

brew upgrade LuLu

Output of command with --verbose --debug

`brew upgrade` usually works, the problem is the result of upgrading the cask.

Output of brew doctor and brew config

$ brew doctor

Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Some installed formulae are deprecated or disabled.
You should find replacements for the following formulae:
  node@16
  [email protected]
  pydocstyle

#############

$ brew config

HOMEBREW_VERSION: 4.2.7-53-g51ec419
ORIGIN: https://github.com/Homebrew/brew
HEAD: 51ec4197c7a43afd2ef96fd7b34ff2fef9677a1e
Last commit: 10 hours ago
Core tap HEAD: 8eea21afc267ea5356701275bf48420b55b90d98
Core tap last commit: 77 minutes ago
Core tap JSON: 07 Feb 08:07 UTC
Core cask tap HEAD: 51cabf9cf4bbe1809e56e3673c99d6d2cdfc852b
Core cask tap last commit: 2 hours ago
Core cask tap JSON: 07 Feb 08:07 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_BAT: set
HOMEBREW_BAT_CONFIG_PATH: /Users/Kevin/.config/bat/config
HOMEBREW_BROWSER: open
HOMEBREW_CACHE: /Users/Kevin/.cache/homebrew
HOMEBREW_CASK_OPTS: ["--appdir=/Applications", "--fontdir=/Library/Fonts"]
HOMEBREW_CLEANUP_MAX_AGE_DAYS: 60
HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS: 14
HOMEBREW_DISPLAY_INSTALL_TIMES: set
HOMEBREW_EDITOR: nvim
HOMEBREW_FORCE_BREWED_CURL: set
HOMEBREW_FORCE_BREWED_GIT: set
HOMEBREW_GITHUB_API_TOKEN: set
HOMEBREW_INSTALL_BADGE: ☕️
HOMEBREW_LOGS: /Users/Kevin/.cache/homebrew/logs
HOMEBREW_MAKE_JOBS: 10
HOMEBREW_NO_ENV_HINTS: set
HOMEBREW_SORBET_RUNTIME: set
HOMEBREW_SSH_CONFIG_PATH: /Users/Kevin/.ssh/config
Homebrew Ruby: 3.1.4 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/bin/ruby
CPU: 10-core 64-bit arm_firestorm_icestorm
Clang: 15.0.0 build 1500
Git: 2.43.0 => /opt/homebrew/opt/git/bin/git
Curl: 8.6.0 => /opt/homebrew/opt/curl/bin/curl
macOS: 14.3-arm64
CLT: 15.0.1.0.2.5
Xcode: 15.2 => /Applications/Xcode-15.2.0.app/Contents/Developer
Rosetta 2: false

Output of brew tap

$ brew tap                           

acarl005/formulas
gcenx/wine
homebrew/bundle
homebrew/cask
homebrew/cask-fonts
homebrew/cask-versions
homebrew/core
homebrew/services
jesseduffield/lazygit
mongodb/brew
nikolaeu/numi
samtay/tui
shaunsingh/sfmono-nerd-font-ligaturized
xcodesorg/made

kevinm6 avatar Feb 07 '24 09:02 kevinm6

Is there an ongoing issue with the way brew upgrade behaves after removing the uninstall script from lulu?

bevanjkay avatar Feb 07 '24 09:02 bevanjkay

@bevanjkay - yeah there is an issue still. It didn't wipe my configuration that I could find, but it tried to run an uninstall which failed on ARM due to "bad CPU type in executable" as the uninstaller is an x86_64 specific binary.

I started some time ago to rewrite the uninstall logic into a _flight block and see if we could somehow make the normal uninstall a no-op.

So I think there's something here to fix, but part of it is certainly upstream in adding ARM support for the uninstall / upgrade binary.

krehel avatar Feb 07 '24 09:02 krehel

@krehel But we aren't running any uninstaller anymore. What you are seeing is a leftover from the previous version of the caskfile.

bevanjkay avatar Feb 07 '24 09:02 bevanjkay

Is there an ongoing issue with the way brew upgrade behaves after removing the uninstall script from lulu?

Since brew upgrade runs brew uninstall first, the app is reset, losing previous data and configuration.

The upgrade for cask LuLu as from the maintainer should be as simple as quit the app and replace it. Even a upgrade stanza from homebrew should be fine, that runs only on brew upgrade but doesn’t trigger brew uninstall (but I know this is a problem for all the other casks and all the homebrew logic) something like this:

upgrade script: {
    executable: "#{staged_path}/LuLu.app/Contents/MacOS/LuLu",
    args:       ["-upgrade"],
    sudo:       true,
  }

The problem is that even if LuLu maintainer has added support for other CLI args, the useful script for uninstall is always the same problem if brew upgrade runs always brew uninstall first.

uninstall script: {
    executable: "#{staged_path}/LuLu.app/Contents/MacOS/LuLu",
    args:       [“-uninstall"],
    sudo:       true,
  }

kevinm6 avatar Feb 07 '24 09:02 kevinm6

This happened twice in the past week

2.6.0 -> 2.6.1 2.6.1 -> 2.6.2

Both of which we shouldn't be running the uninstall, I agree. But yet it still seemed to trigger. Unless I need to do a complete removal and reinstall to reset something?

krehel avatar Feb 07 '24 09:02 krehel

@krehel But we aren't running any uninstaller anymore. What you are seeing is a leftover from the previous version of the caskfile.

That seems weird. If brew upgrade runs brew uninstall first, the LuLu uninstall script is triggered, or not?

kevinm6 avatar Feb 07 '24 09:02 kevinm6

The current caskfile does not do anything when upgrading or uninstalling except remove the .app file. So you may have an outdated version in your Caskroom if the upgrade is failing to complete.

https://github.com/Homebrew/homebrew-cask/blob/47092142d74bd8059f553ffccf9a32bdf3d999fe/Casks/l/lulu.rb

There would be more than a handful of apps that provide an "uninstaller" that we don't use because generally speaking, the zap stanza will suffice. The logic behind homebrew-cask suggests that an uninstall will not remove application files, unless you pass zap.

So we could try to replicate as much logic from the upstream uninstaller as possible to the zap stanza.

It is currently not possible to run the uninstaller in the zap stanza, as it will be removed before getting to it (and therefore not exist when zap is initiated. When this issue is closed it would be possible - https://github.com/Homebrew/brew/issues/15070

bevanjkay avatar Feb 07 '24 09:02 bevanjkay

I'd say also there's different issues at play here. Mine is assuredly an upstream issue as the uninstall needs to be compiled for ARM, I'm just thinking of workarounds.

krehel avatar Feb 07 '24 09:02 krehel

I'd say also there's different issues at play here. Mine is assuredly an upstream issue as the uninstall needs to be compiled for ARM, I'm just thinking of workarounds.

I don’t know what’s happening to you, I don’t have any issue on uninstalling it via Homebrew on ARM.

kevinm6 avatar Feb 07 '24 10:02 kevinm6

That adds another twist for me at least. I wonder if when trying to debug this uninstall issue sometime ago I accidentally installed the intel version.

Thanks for the data point on that. I'll investigate my own issue.

krehel avatar Feb 07 '24 10:02 krehel

@krehel maybe, or double check if you made some change to your local tap and you’re using that for LuLu cask installs and update with HOMEBREW_NO_INSTALL_FROM_API=1 set.

kevinm6 avatar Feb 07 '24 10:02 kevinm6

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

github-actions[bot] avatar Feb 29 '24 00:02 github-actions[bot]

Not happening lately with last updates. I'll reopen in case something happens again.

kevinm6 avatar Mar 07 '24 23:03 kevinm6