homebrew-cask
homebrew-cask copied to clipboard
`launchctl:` does not support wildcards, but a few casks use it anyway: avast-secureline-vpn, boom, box-drive, paragon-extfs, paragon-ntfs
General troubleshooting steps
- [x] I understand that if I ignore these instructions, my issue may be closed without review.
- [x] I have retried my command with
--force
. - [x] I ran
brew update-reset && brew update
and retried my command. - [x] I ran
brew doctor
, fixed as many issues as possible and retried my command. - [x] I have checked the instructions for reporting bugs.
- [x] I made doubly sure this is not a checksum does not match error.
Description of issue
The lanchtctl:
key in the uninstall
stanza does not support wildcards, but a few Casks attempt to use this anyway. This ends up making it a no-op since that this string doesn't match any launchd job ids.
PR #79620 fixes this for the sound-control cask, but these casks all have the same problem:
- https://github.com/Homebrew/homebrew-cask/blob/master/Casks/avast-secureline-vpn.rb
- https://github.com/Homebrew/homebrew-cask/blob/master/Casks/boom.rb
- https://github.com/Homebrew/homebrew-cask/blob/master/Casks/box-drive.rb
- https://github.com/Homebrew/homebrew-cask/blob/master/Casks/paragon-extfs.rb
- https://github.com/Homebrew/homebrew-cask/blob/master/Casks/paragon-ntfs.rb
From brew cask --debug uninstall
you can see that the *
is escaped, but even if it wasn't, launchctl doesn't have any built in support for regexes so it wouldn't work in either case. See #79620 for a little more discussion on this issue.
...
==> Removing launchctl service com.staticz.soundcontrol.*
/bin/launchctl list com.staticz.soundcontrol.\*
/usr/bin/sudo -E -- /bin/launchctl list com.staticz.soundcontrol.\*
To fix this you'll need to install each cask, identify the full names of the launchd jobs it installs, and then enumerate all the job ids in the cask. Or improve launchctl:
so that it accepts wildcards.
To fix this you'll need to install each cask, identify the full names of the launchd jobs it installs, and then enumerate all the job ids in the cask.
For anyone tackling this task, run "$(brew --prefix)/Homebrew/Library/Taps/homebrew/homebrew-cask/developer/bin/list_loaded_launchjob_ids"
to identify all loaded launchd jobs.
On a somewhat related note, when bumping a cask (#107326), I noticed the CI kept failing on a different launch job name, which seems like it would need a wildcard to fix (at least until upstream change), e.g.
-
com.paulpacifico.shutterencoder.16816.84165EC3-AD85-4A8D-8F98-608D03579037
-
com.paulpacifico.shutterencoder.16816.DB72FFFF-CC60-4F46-82E3-BF8131AE5BE0
-
com.paulpacifico.shutterencoder.16820.397F3104-E5CD-486D-9FFF-5BEB0CD26EF3
For a very basic wildcard, we might be able to use similar logic to running_processes
https://github.com/Homebrew/brew/blob/514271010a7d968bc3f8618fdf76814498b2aa91/Library/Homebrew/cask/artifact/abstract_uninstall.rb#L124
The main part to change would be regex check to something like
/\A#{Regexp.escape(service).gsub("\\*", ".*")}\Z/.match?(id)
Though, could also consider allowing escape character like com.\*.foo
to use escaped *
(not sure if valid name, but raw asterisks are valid input).
Currently don't have time to test if it is possible in Homebrew.
If I have a chance, I'll try to see if it can work with launchctl
I did do some basic Ruby tests copying launchctl list
output into a file and then running
data = < ... launchctl list data ... >
service = ARGV[0]
p data.lines.drop(1)
.map { |line| line.chomp.split("\t") }
.select { |_, _, id| /\A#{Regexp.escape(service).gsub("\\*", ".*")}\Z/.match?(id) }
.map{ |_, _, id| id }
With:
❯ ruby test.rb 'com.*.ATS.F'
[]
❯ ruby test.rb 'com.*.ATS.F*'
["com.apple.ATS.FontValidator", "com.apple.ATS.FontValidatorConduit"]
❯ ruby test.rb 'com.*.ATS.F*t'
["com.apple.ATS.FontValidatorConduit"]
❯ ruby test.rb 'com.*.F*t'
["com.apple.FontRegistryUIAgent", "com.apple.ATS.FontValidatorConduit"]