From 93a9776e34731c02918a4973fcc2a5d96b9353dd Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 14 Jan 2025 08:52:20 +0000 Subject: [PATCH] cask/cask: ensure plist is readable before reading. If we don't have permissions to read it, this will raise an exception even although this whole call chain is very tolerant of nil values. --- Library/Homebrew/cask/cask.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/cask/cask.rb b/Library/Homebrew/cask/cask.rb index 75a9e00b42..4a82c576f9 100644 --- a/Library/Homebrew/cask/cask.rb +++ b/Library/Homebrew/cask/cask.rb @@ -515,7 +515,7 @@ module Cask sig { returns(T.nilable(Homebrew::BundleVersion)) } def bundle_version @bundle_version ||= if (bundle = artifacts.find { |a| a.is_a?(Artifact::App) }&.target) && - (plist = Pathname("#{bundle}/Contents/Info.plist")) && plist.exist? + (plist = Pathname("#{bundle}/Contents/Info.plist")) && plist.exist? && plist.readable? Homebrew::BundleVersion.from_info_plist(plist) end end