fix: Move the quarantine hook ahead of completion generation - #352
Merged
Conversation
Installing v4.3.1 popped Gatekeeper and produced no completions. Homebrew sorts cask artifacts by class, so `GeneratedCompletion` always runs before `PostflightBlock` — it executed the binary while the quarantine bit was still on and Gatekeeper killed it. `PreflightBlock` is the only hook that runs first. - Drop `args: [completion]`: the cobra format already appends `completion <shell>`, so it ran `completion completion bash`, which exits 0 but writes cobra's help text instead of the completion script - Drop `shells`: the cobra default adds pwsh, which works fine here
Merged
Owner
Author
|
Verified on v4.3.2. All four completion files landed: The bash file is 16573 bytes rather than the 827 bytes of cobra help text that
|
This was referenced Aug 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #351. Installing v4.3.1 via the new cask popped the Gatekeeper dialog and installed no completions.
Two separate bugs in one line of output.
1. The hook fired too late
Homebrew orders cask artifacts by class, not by the order they appear in the Cask file. From
abstract_artifact.rb:GeneratedCompletionexecutes the binary to produce completions, and it runs beforePostflightBlock. So thexattr -dr com.apple.quarantinenever got a chance — Gatekeeper killed the process with SIGKILL first.GoReleaser's cask template has a comment claiming it emits
postflightbeforegenerate_completions_from_executablefor exactly this reason (goreleaser#5958), but textual order is irrelevant once Homebrew sorts.PreflightBlockruns before everything else, andstaged_pathalready exists by then —Installer#installcallsstagebeforeinstall_artifacts.2.
argswas wrong from the startshell_parameter_format: cobraalready makes Homebrew appendcompletion <shell>(shell_completion.rb):Adding
args: [completion]on top producedcompletion completion bash. This one is nastier than it looks, because it does not fail:completion completion bashcompletion bashWithout the Gatekeeper crash, broken completion files would have been installed silently.
Also dropped
shellsIt was pinned to bash/zsh/fish only to match the old Formula. The cobra default adds
pwsh, which works here: cobra emits PowerShell completions, and the cask side supports them —SUPPORTED_SHELLS = [:bash, :zsh, :fish, :pwsh]ingenerated_completion.rb. PowerShell runs on macOS and Linux too.The whole stanza is now one line.
Generated cask
Verification
make release-checkpassesmake distemitspreflightand a single-argumentgenerate_completions_from_executablebrew upgradeon a machine with v4.3.1 installed, confirm no Gatekeeper dialog and that completions land in$(brew --prefix)/share