cask/artifact: don't copy xattrs when quarantine is unavailable - #23617
Merged
Conversation
When an install or upgrade reuses an existing target directory, Moved#move copies the source's extended attributes with Quarantine.copy_xattrs, which is implemented on macOS only and raises NotImplementedError elsewhere. Guard the call with Quarantine.available? like the module's other call sites.
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.
Following on from #23608, which fixed a defect I had recently introduced in #23556 by failing to guard a call to
Quarantine.detect. Upon discovering my mistake, I checked every other call site of the Quarantine methods that raise where there is no quarantine support, and found one existing instance of the same defect: two call sites indownload.rband one inaudit.rbwere already guarded (#23229), two inupgrade.rbwere guarded by #23608, but one inmoved.rbwas unguarded. This PR addresses that defect.When an install or upgrade reuses an existing target directory — the adopt/overwrite path, and ordinary upgrades, which keep the app directory in place —
Moved#movecopies the source's extended attributes withQuarantine.copy_xattrs. That method is implemented in the macOS extension only; the base module raisesNotImplementedError, so on Linux the install dies mid-move. The fix guards the call withQuarantine.available?, as the module's other call sites do. As with #23608, I have not seen this reported — reaching it needs a cask installed on Linux — so this is closing a latent hole rather than fixing a live crash.To reproduce, on a system without quarantine support, with any installed app cask:
Details
brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?Used Claude Code (Fable 5) to investigate and draft; I directed the investigation, and reviewed the diff and every line of this PR text.