Skip to content

[CI] brew audit failure at check_https_availability for large (2GB+) files #107214

Open
@cho-m

Description

Description of issue

In some PRs, Homebrew's CI hits an audit failure due to trying to read large (2GB+) files into memory.

Specifically, the failure happens in curl_http_content_headers_and_checksum at
https://github.com/Homebrew/brew/blob/d3887df2a39d270c7988985c5bf9099c8229aeca/Library/Homebrew/utils/curl.rb#L286-L289

      if status.success?
        file_contents = File.read(file.path)
        file_hash = Digest::SHA2.hexdigest(file_contents) if hash_needed
      end

Seen in #107181

exception while auditing unity: Invalid argument @ io_fread - /private/tmp/20210612-3010-1sx7ka6<br class="Apple-interchange-newline">

and #106950

exception while auditing final-fantasy-xiv: Invalid argument @ io_fread - /private/tmp/20210609-2949-1spku3h<br class="Apple-interchange-newline">

along with some other PRs.

Command that failed

brew audit --cask --appcast --online './Casks/unity.rb'

Output of command with --verbose --debug

Click to expand
==> Verifying checksum for cask 'unity'
/usr/bin/curl --disable --globoff --show-error --user-agent Homebrew/3.1.12-15-gd3887df\ \(Macintosh\;\ Intel\ Mac\ OS\ X\ 10.15.7\)\ curl/7.64.1 --header Accept-Language:\ en --retry 3 --dump-header - --output /private/tmp/20210613-3195-xxh8yw --location --connect-timeout 15 --max-time 25 --retry-max-time 25 https://download.unity3d.com/download_unity/4d8c25f7477e/MacEditorInstaller/Unity-2021.1.11f1.pkg
==> Invalid argument @ io_fread - /private/tmp/20210613-3195-xxh8yw
/usr/local/Homebrew/Library/Homebrew/utils/curl.rb:287:in `read'
/usr/local/Homebrew/Library/Homebrew/utils/curl.rb:287:in `curl_http_content_headers_and_checksum'
/usr/local/Homebrew/Library/Homebrew/utils/curl.rb:202:in `block in curl_check_http_content'
/usr/local/Homebrew/Library/Homebrew/utils/curl.rb:200:in `each'
/usr/local/Homebrew/Library/Homebrew/utils/curl.rb:200:in `curl_check_http_content'
/usr/local/Homebrew/Library/Homebrew/cask/audit.rb:753:in `check_url_for_https_availability'
/usr/local/Homebrew/Library/Homebrew/cask/audit.rb:737:in `check_https_availability'
/usr/local/Homebrew/Library/Homebrew/cask/audit.rb:66:in `run!'
/usr/local/Homebrew/Library/Homebrew/cask/auditor.rb:141:in `audit_cask_instance'
/usr/local/Homebrew/Library/Homebrew/cask/auditor.rb:87:in `audit'
/usr/local/Homebrew/Library/Homebrew/cask/auditor.rb:38:in `audit'
/usr/local/Homebrew/Library/Homebrew/cask/cmd/audit.rb:104:in `block in audit_casks'
/usr/local/Homebrew/Library/Homebrew/cask/cmd/audit.rb:102:in `map'
/usr/local/Homebrew/Library/Homebrew/cask/cmd/audit.rb:102:in `audit_casks'
/usr/local/Homebrew/Library/Homebrew/dev-cmd/audit.rb:210:in `audit'
/usr/local/Homebrew/Library/Homebrew/brew.rb:122:in `<main>'

Output of brew doctor --verbose

N/A. Has been occurring on CI nodes.
Haven't been able to reproduce locally.
e.g. https://github.com/Homebrew/homebrew-cask/runs/2810177842?check_suite_focus=true

Output of brew tap

N/A. Has been occurring on CI nodes.
Haven't been able to reproduce locally.
e.g. https://github.com/Homebrew/homebrew-cask/runs/2810177842?check_suite_focus=true

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions