-
-
Notifications
You must be signed in to change notification settings - Fork 10.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
[CI] brew audit
failure at check_https_availability
for large (2GB+) files
#107214
Comments
Some possibilities:
|
brew audit
failure at check_https_availability
for large (2GB+) filesbrew audit
failure at check_https_availability
for large (2GB+) files
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
I was taking a look. Thought it'd be possible to change https://github.com/Homebrew/brew/blob/e62094f52aa7203106f5c9b9447679488f6f2dc7/Library/Homebrew/utils/curl.rb#L340-L341 into a file stream, e.g. file_hash = Digest::SHA2.new
chunk_size = 1024 # bytes
File.open(file.path) do |f|
while chunk = f.read(chunk_size)
file_hash << chunk
end
end
file_hash = file_hash.hexdigest Chunking seems to work fine; however, it looks like the entire Returned here https://github.com/Homebrew/brew/blob/e62094f52aa7203106f5c9b9447679488f6f2dc7/Library/Homebrew/utils/curl.rb#L354 I'm not aware of a way to grep a binary without slurping the entire file. If there's a way to discover that appcast version without reading the entire file into memory (I'm not familiar with appcast, if there's a file prefix, could take advantage of parsing that instead), then could remove reading the entire file and returning it (which I think would be a good idea anyways). A workaround could be to make this function optional here maybe? https://github.com/Homebrew/brew/blob/e62094f52aa7203106f5c9b9447679488f6f2dc7/Library/Homebrew/cask/audit.rb#L76 |
Thanks for doing this!
This makes sense to me.
Could we somehow break the file up into overlapping chunks so that we can grep each chunk without loss of information? |
Original comment about file chunking
Depends on what's what's being matched. If it's a known file position (i.e. a prefix or something parse-able), or has a known maximum size, yeah I think you can. We could create a sliding window of size file_name = 'example.txt'
target = '1.2.3'
chunk_size = target.length
contains = false
File.open(file_name) do |f|
contains = for pos in 0.step()
begin
chunk = f.pread(chunk_size, pos)
break true if chunk == target
rescue EOFError
break false
end
end
end
p contains Essentially, just read a fixed chunk size at every position until either (1) the exact match is found or (2) we reach EOF. However, iterative Yeah, chunking, by some arbitrary fixed value (128MB) and using file_name = 'example.txt'
target = 'example'
target_size = target.length
chunk_size = 128 * 1000000 # 128MB
contains = false
File.open(file_name) do |f|
contains = for i in 0.step()
pos = i * (chunk_size - target_size)
begin
chunk = f.pread(chunk_size, pos)
break true if chunk.include? target
rescue EOFError
break false
end
end
end
p contains Anyway, I couldn't reproduce locally. I re-read the issue. I have a sense now it might not be a file size issue, but a naming one? The file name I looked back at the Unity cask history. Looks like Sorry I went on a goose chase here with file sizes. The file chunking in the collapsed section might be useful for something else, but have a feeling it doesn't help with this issue (which might be resolved with the removal of the |
--force
.brew update-reset && brew update
and retried my command.brew doctor
, fixed as many issues as possible and retried my command.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
athttps://github.com/Homebrew/brew/blob/d3887df2a39d270c7988985c5bf9099c8229aeca/Library/Homebrew/utils/curl.rb#L286-L289
Seen in #107181
and #106950
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
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
The text was updated successfully, but these errors were encountered: