-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cask/quarantine: sudo correctly during tests. #15968
cask/quarantine: sudo correctly during tests. #15968
Conversation
What is |
It's explicitly set to not be writable in the test.
If you can reproduce the same behaviour in Not The Test Environment: sure. This just feels like an omission when underlying functionality was changed, though. |
Right I understand the situation now. In the test we pass The issue here is we don't pass this further down to the |
I tested out @Bo98's idea and the failing test now succeeds for me locally. diff --git a/Library/Homebrew/cask/artifact/moved.rb b/Library/Homebrew/cask/artifact/moved.rb
index d41e62cec..a9e3470d7 100644
--- a/Library/Homebrew/cask/artifact/moved.rb
+++ b/Library/Homebrew/cask/artifact/moved.rb
@@ -91,7 +91,7 @@ module Cask
command.run!("/bin/cp", args: ["-pR", *source.children, target],
sudo: true)
end
- Quarantine.copy_xattrs(source, target)
+ Quarantine.copy_xattrs(source, target, command: command)
source.rmtree
elsif target.dirname.writable?
FileUtils.move(source, target)
diff --git a/Library/Homebrew/cask/quarantine.rb b/Library/Homebrew/cask/quarantine.rb
index 227790629..e038011e6 100644
--- a/Library/Homebrew/cask/quarantine.rb
+++ b/Library/Homebrew/cask/quarantine.rb
@@ -174,11 +174,11 @@ module Cask
raise CaskQuarantinePropagationError.new(to, quarantiner.stderr)
end
- sig { params(from: Pathname, to: Pathname).void }
- def self.copy_xattrs(from, to)
+ sig { params(from: Pathname, to: Pathname, command: T.class_of(SystemCommand)).void }
+ def self.copy_xattrs(from, to, command:)
odebug "Copying xattrs from #{from} to #{to}"
- system_command!(
+ command.run!(
swift,
args: [
*swift_target_args, |
@Bo98 Good catch, will try to take a look, thanks. |
Thanks @Bo98 @apainintheneck have updated accordingly based on your feedback and diff. |
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 <[email protected]> Co-authored-by: Kevin <[email protected]>
Thanks for the help with fixing this! I thought it was maybe a local problem when I first saw it pop up since CI has been green the whole time. |
Fixes #15958