cask/upgrade: don't read quarantine metadata when quarantine is unavailable - #23608
Merged
Merged
Conversation
…ilable The pre-upgrade snapshot of an app's quarantine state calls Quarantine.detect, which raises when there is no xattr binary to run, as on Linux. Everything the snapshot collects is used only inside the Quarantine.available? branch below it, so guard the snapshot with the same condition.
MikeMcQuaid
approved these changes
Aug 22, 2026
MikeMcQuaid
left a comment
Member
There was a problem hiding this comment.
Makes sense, thanks again @aholland!
This was referenced Aug 22, 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.
Cask::Upgradesnapshots each app's quarantine state before swapping in the new version. One of the calls it makes,Quarantine.detect, raisesunexpected nil xattrwhen there is noxattrbinary to run, which is the normal state on Linux. Everything the snapshot collects is used only inside theQuarantine.available?branch below it, so the snapshot can carry the same guard.I introduced this in #23556, which added the
Quarantine.detectcall without the guard its neighbours in that block already have:user_approved?anduser_approved_pathsboth return early when there is noxattr, andsigning_identityis a stub off macOS, sodetectis the only one of the four that raises.Homebrew's own CI cannot catch this. The
Homebrew Caskshared context is declared:needs_macos, andshared_context_metadata_behavioris:apply_to_host_groups, so every:caskspec inherits that tag and is skipped on Linux. That is also why the same class of bug inbrew audit(#23226, fixed in #23229) surfaced in homebrew-cask's CI rather than here. It is why the test below simulates an unsupported system instead of being tagged:needs_linux, which would skip on every platform.To reproduce, on Linux or anywhere else with no
xattron the path, with an outdated cask that installs an app:I have not seen this reported, and I would expect very few people to reach it, since it needs a cask actually installed on Linux. #23226 was the same defect in
brew audit, which Linux does reach routinely because homebrew-cask audits every cask on Linux CI. This is the upgrade-path sibling of that bug, so it is worth closing even though the path is quieter.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.