wsdd-native icon indicating copy to clipboard operation
wsdd-native copied to clipboard

macOS Homebrew: Cannot upgrade/remove wsdd-native

Open xubiod opened this issue 4 months ago • 3 comments

Not sure if I should report the issue to Homebrew itself or to the package, but currently reporting here unless marked as not appropriate to report here. Apologies in advance.

Homebrew cannot upgrade this package, as it has problems uninstalling the old version to upgrade.

❯ brew upgrade wsddn
==> Downloading https://formulae.brew.sh/api/formula.jws.json
==> Downloading https://formulae.brew.sh/api/cask.jws.json
==> Upgrading 1 outdated package:
gershnik/repo/wsddn 1.21 -> 1.21.1
==> Upgrading wsddn
==> Downloading https://github.com/gershnik/wsdd-native/releases/download/v1.21/wsddn-macos-1.21.pkg
Already downloaded: /Users/xubiod/Library/Caches/Homebrew/downloads/97de8d9b7e16a8fe26d560923dce7fa3706e7a1f50efeea746d5a56e3bc02996--wsddn-macos-1.21.pkg
==> Removing launchctl service io.github.gershnik.wsddn
Password:
==> Running uninstall script bash
==> Purging files for version 1.21.1 of Cask wsddn
Error: gershnik/repo/wsddn: Parameter 'cmd': Expected type String, got type Pathname with value #<Pathname:bash>
Caller: /opt/homebrew/Library/Homebrew/cask/artifact/abstract_uninstall.rb:379
Definition: /opt/homebrew/Library/Homebrew/extend/kernel.rb:93 (Kernel#which)
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12434/lib/types/configuration.rb:296:in 'T::Configuration.call_validation_error_handler_default'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12434/lib/types/configuration.rb:303:in 'T::Configuration.call_validation_error_handler'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12434/lib/types/private/methods/call_validation.rb:322:in 'T::Private::Methods::CallValidation.report_error'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12434/lib/types/private/methods/call_validation.rb:230:in 'block in T::Private::Methods::CallValidation.validate_call'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12434/lib/types/private/methods/signature.rb:213:in 'T::Private::Methods::Signature#each_args_value_type'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12434/lib/types/private/methods/call_validation.rb:227:in 'T::Private::Methods::CallValidation.validate_call'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12434/lib/types/private/methods/_methods.rb:277:in 'block in Kernel#_on_method_added'
/opt/homebrew/Library/Homebrew/cask/artifact/abstract_uninstall.rb:379:in 'Cask::Artifact::AbstractUninstall#uninstall_script'
/opt/homebrew/Library/Homebrew/cask/artifact/abstract_uninstall.rb:77:in 'Cask::Artifact::AbstractUninstall#dispatch_uninstall_directive'
/opt/homebrew/Library/Homebrew/cask/artifact/uninstall.rb:22:in 'block in Cask::Artifact::Uninstall#uninstall_phase'
/opt/homebrew/Library/Homebrew/cask/artifact/uninstall.rb:21:in 'Array#each'
/opt/homebrew/Library/Homebrew/cask/artifact/uninstall.rb:21:in 'Cask::Artifact::Uninstall#uninstall_phase'
/opt/homebrew/Library/Homebrew/cask/installer.rb:606:in 'block in Cask::Installer#uninstall_artifacts'
/opt/homebrew/Library/Homebrew/cask/artifact_set.rb:15:in 'Array#each'
/opt/homebrew/Library/Homebrew/cask/artifact_set.rb:15:in 'Cask::ArtifactSet#each'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12434/lib/types/private/methods/call_validation_2_7.rb:652:in 'UnboundMethod#bind_call'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12434/lib/types/private/methods/call_validation_2_7.rb:652:in 'block in Cask::ArtifactSet#create_validator_procedure_fast0'
/opt/homebrew/Library/Homebrew/cask/installer.rb:591:in 'Cask::Installer#uninstall_artifacts'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12434/lib/types/private/methods/call_validation.rb:282:in 'UnboundMethod#bind_call'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12434/lib/types/private/methods/call_validation.rb:282:in 'T::Private::Methods::CallValidation.validate_call'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12434/lib/types/private/methods/_methods.rb:277:in 'block in Cask::Installer#_on_method_added'
/opt/homebrew/Library/Homebrew/cask/installer.rb:552:in 'Cask::Installer#start_upgrade'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12434/lib/types/private/methods/call_validation.rb:282:in 'UnboundMethod#bind_call'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12434/lib/types/private/methods/call_validation.rb:282:in 'T::Private::Methods::CallValidation.validate_call'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12434/lib/types/private/methods/_methods.rb:277:in 'block in Cask::Installer#_on_method_added'
/opt/homebrew/Library/Homebrew/cask/upgrade.rb:235:in 'Cask::Upgrade.upgrade_cask'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12434/lib/types/private/methods/call_validation.rb:282:in 'UnboundMethod#bind_call'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12434/lib/types/private/methods/call_validation.rb:282:in 'T::Private::Methods::CallValidation.validate_call'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12434/lib/types/private/methods/_methods.rb:277:in 'block in Cask::Upgrade._on_method_added'
/opt/homebrew/Library/Homebrew/cask/upgrade.rb:151:in 'block in Cask::Upgrade.upgrade_casks!'
/opt/homebrew/Library/Homebrew/cask/upgrade.rb:150:in 'Array#each'
/opt/homebrew/Library/Homebrew/cask/upgrade.rb:150:in 'Cask::Upgrade.upgrade_casks!'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12434/lib/types/private/methods/call_validation.rb:282:in 'UnboundMethod#bind_call'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12434/lib/types/private/methods/call_validation.rb:282:in 'T::Private::Methods::CallValidation.validate_call'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12434/lib/types/private/methods/_methods.rb:277:in 'block in Cask::Upgrade._on_method_added'
/opt/homebrew/Library/Homebrew/cmd/upgrade.rb:292:in 'Homebrew::Cmd::UpgradeCmd#upgrade_outdated_casks!'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12434/lib/types/private/methods/call_validation.rb:282:in 'UnboundMethod#bind_call'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12434/lib/types/private/methods/call_validation.rb:282:in 'T::Private::Methods::CallValidation.validate_call'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12434/lib/types/private/methods/_methods.rb:277:in 'block in Homebrew::Cmd::UpgradeCmd#_on_method_added'
/opt/homebrew/Library/Homebrew/cmd/upgrade.rb:142:in 'Homebrew::Cmd::UpgradeCmd#run'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12434/lib/types/private/methods/call_validation.rb:282:in 'UnboundMethod#bind_call'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12434/lib/types/private/methods/call_validation.rb:282:in 'T::Private::Methods::CallValidation.validate_call'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12434/lib/types/private/methods/_methods.rb:277:in 'block in Homebrew::Cmd::UpgradeCmd#_on_method_added'
/opt/homebrew/Library/Homebrew/brew.rb:101:in '<main>'
Please report this issue:
  https://docs.brew.sh/Troubleshooting

xubiod avatar Aug 28 '25 12:08 xubiod

Thank you for reporting and while it is, indeed, ultimately a Homebrew issue, it is entirely appropriate!

First the workaround. Do this on the command line

rm -rf $(brew --prefix)/Caskroom/wsddn

Then install wsddn and this time it should go smoothly. The new version will then uninstall cleanly when needed.

Now the details. Recent Homebrew update broke something in how they invoke the uninstall script. The update to work around this change is easy and it is in the latest wsddn 1.21.1 which you tried to install. However, there appears to be no way to patch the old installed version during the update to uninstall cleanly.

Homebrew first uninstalls the old cask and then installs the new one. There is, as far as I can see, no "hook" in the cask install script that runs prior to the old version uninstallation. Which, unfortunately, means that the only way to get rid of the old one is to manually remove its record. Which is a shame - pretty much every other package manager in the world lets you handle such situations cleanly.

Sorry about that, and hope it helps.

gershnik avatar Aug 28 '25 14:08 gershnik

In my head I couldn't really figure out what the issue was despite being a software dev myself, but can't know everything. I didn't know about removing the records manually which if I did might not have led to the issue.

Also assuming pinning it so if others encounter it there's at least a common point with the workaround and why the workaround needs to be done and whatnot.

Thank you for the assistance, and also frankly letting me learn something today, heh.

xubiod avatar Aug 28 '25 14:08 xubiod

You are most welcome!

In fairness, package manager users should not need to know how to manually remove internal package manager records. There ought to be a user command that you could use to forcefully forget or overwrite one. Unfortunately, (again) Homebrew's --force, --zap and whatnot do nothing in this case. They still attempt to uninstall the old version and barf if they cannot.

This isn't the only case when such issues arise. See e.g. this Stack Overflow question. There are quite a few others too.

This kind of stuff is yet another reason why I am not a fan of Homebrew but I can understand why people are using it. No better alternative.

gershnik avatar Aug 28 '25 14:08 gershnik