Use `NeverSudoSystemCommand` and pass it through to
`Quarantine.copy_xattrs` so `brew tests` doesn't try to `sudo`.
Fixes#15958
Co-authored-by: Bo Anderson <mail@boanderson.me>
Co-authored-by: Kevin <apainintheneck@gmail.com>
With the update of MacOS from Monterey (12) to Ventura (13) the appearance of the System Settings has changes and the "Security & Privacy" category has been renamed to "Privacy & Security".
I am aware that currently Ventura has a very low adoption rate so this change could be premature.
Changes the rescue clause to also handle EPERM.
This fixes the issue of cask upgrades/reinstalls to failing due to
permissions [1]. It's worth noting though, the prompt for allowing App
Management permissions does not seem to occur, so that's something else
to be investigated.
1. https://github.com/Homebrew/homebrew-cask/issues/148253
Signed-off-by: Ismayil Mirzali <ismayilmirzeli@gmail.com>
Quarantine is available ONLY if the script exits with '2'.
It is definitely NOT available if Swift doesn't exist or if
it exits with '5' (incompatible SDK). All other cases are
from now on treated as unsupported.
Also print to standard error only when explictly required (via an
exception).
Gatekeeper's Path Randomization is currently making automated
installation a nightmare. Let's manually toggle the (undocumented) app
translocation bit in the `com.apple.quarantine` extended attribute.
While we're at it, let's also toss in some fixes:
- zip downloads with improper permissions that prevent us from
quarantining
- quarantine/release/skip downloads as requested by the user
- In some cases (usually old CLT versions) Swift is available but needs an
extra guard to use the quarantine API.
- xattr's native filesystem recursion is an Apple extension which is
not available in Mojave; so let's use xargs.
- Insert a quarantine support check in brew cask doctor.
FixesHomebrew/homebrew-cask#51554, and fixesHomebrew/homebrew-cask#51538.