From 700cbd893b8b46cb121114fc8669f798c69f20b1 Mon Sep 17 00:00:00 2001 From: Justin Krehel <39449589+krehel@users.noreply.github.com> Date: Wed, 29 May 2024 11:36:32 -0400 Subject: [PATCH] cask/audit: fix nested container extraction Fixes edge cases where nested containers are used. Extraction for auditing artifacts did not pull the secondary container, which tried to audit the container instead of the contents. --- Library/Homebrew/cask/audit.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Library/Homebrew/cask/audit.rb b/Library/Homebrew/cask/audit.rb index 54156fc69c..c6e93d3b3f 100644 --- a/Library/Homebrew/cask/audit.rb +++ b/Library/Homebrew/cask/audit.rb @@ -549,6 +549,13 @@ module Cask # Extract the container to the temporary directory. primary_container.extract_nestedly(to: @tmpdir, basename: downloaded_path.basename, verbose: false) + + if (nested_container = @cask.container&.nested) + FileUtils.chmod_R "+rw", @tmpdir/nested_container, force: true, verbose: false + UnpackStrategy.detect(@tmpdir/nested_container, merge_xattrs: true) + .extract_nestedly(to: @tmpdir, verbose: false) + end + @artifacts_extracted = true # Set the flag to indicate that extraction has occurred. # Yield the artifacts and temp directory to the block if provided.