Skip to content
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

Argument out of range, issue in resolve_url_basename_time_file_size #17556

Closed
6 tasks done
gerritvreeman opened this issue Jun 23, 2024 · 2 comments · Fixed by #17571
Closed
6 tasks done

Argument out of range, issue in resolve_url_basename_time_file_size #17556

gerritvreeman opened this issue Jun 23, 2024 · 2 comments · Fixed by #17571
Assignees
Labels
bug Reproducible Homebrew/brew bug help wanted We want help addressing this

Comments

@gerritvreeman
Copy link

Verification

Description of issue

First, I apologize if this isn't the correct place to file this - the issue might be upstream, downstream, or my own error, just looking for guidance. I'm trying to make a cask to install some software that I frequently use, but keep getting an argument out of range error when trying to install. Here's the cask code:

cask "olex2" do
  version "1.5"
  sha256 :no_check
  url "https://secure.olex2.org/olex2-distro/olex2-#{version}.app.dmg",
      verified: "secure.olex2.org/"
  name "olex2"
  desc "desc."
  homepage "https://www.olexsys.org/olex2/"
  app "olex2.app"
end

I can curl the dmg fine with the url, which makes me think that it's not an issue with where it's hosted. Instead, the error seems to occur in the resolve_url_basename_time_file_size function when it's checking the last-modified header (I think?) of the dmg. curl --head <url> shows Last-Modified: 2/29/24 11:29 AM for the last modified date header, maybe it's a non-standard format which the resolve_url_basename_time_file_size function can't parse and then fails? Or a leap day issue? I feel like the expected behavior is for it not to fail even if the dmg has an issue with the last-modified header, but I could just be making a really simple mistake here and I'm not very familiar with ruby.

Command that failed

brew install --cask ./olex2.rb

Output of command with --verbose --debug

/usr/local/Homebrew/Library/Homebrew/brew.rb (Cask::CaskLoader::FromPathLoader): loading ./olex2.rb
==> Cask::Installer#install
==> Printing caveats
==> Cask::Installer#fetch
/usr/bin/env /usr/local/Homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --show-error --user-agent Homebrew/4.3.6\ \(Macintosh\;\ Intel\ Mac\ OS\ X\ 14.5\)\ curl/8.6.0 --header Accept-Language:\ en --retry 3 --fail --location --silent --head https://secure.olex2.org/olex2-distro/olex2-1.5.app.dmg
/usr/bin/env /usr/local/Homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --show-error --user-agent Homebrew/4.3.6\ \(Macintosh\;\ Intel\ Mac\ OS\ X\ 14.5\)\ curl/8.6.0 --header Accept-Language:\ en --retry 3 --fail --location --silent --head --request GET https://secure.olex2.org/olex2-distro/olex2-1.5.app.dmg
Error: argument out of range
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.3/lib/ruby/3.3.0/time.rb:271:in `local'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.3/lib/ruby/3.3.0/time.rb:271:in `make_time'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.3/lib/ruby/3.3.0/time.rb:386:in `parse'
/usr/local/Homebrew/Library/Homebrew/download_strategy.rb:523:in `block in resolve_url_basename_time_file_size'
/usr/local/Homebrew/Library/Homebrew/download_strategy.rb:523:in `map'
/usr/local/Homebrew/Library/Homebrew/download_strategy.rb:523:in `resolve_url_basename_time_file_size'
/usr/local/Homebrew/Library/Homebrew/download_strategy.rb:470:in `resolved_url_and_basename'
/usr/local/Homebrew/Library/Homebrew/download_strategy.rb:317:in `resolved_basename'
/usr/local/Homebrew/Library/Homebrew/download_strategy.rb:301:in `cached_location'
/usr/local/Homebrew/Library/Homebrew/download_strategy.rb:274:in `temporary_path'
/usr/local/Homebrew/Library/Homebrew/download_strategy.rb:398:in `fetch'
/usr/local/Homebrew/Library/Homebrew/downloadable.rb:86:in `fetch'
/usr/local/Homebrew/Library/Homebrew/cask/download.rb:53:in `fetch'
/usr/local/Homebrew/Library/Homebrew/cask/installer.rb:186:in `download'
/usr/local/Homebrew/Library/Homebrew/cask/installer.rb:69:in `fetch'
/usr/local/Homebrew/Library/Homebrew/cask/installer.rb:102:in `install'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:246:in `block in run'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:235:in `each'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:235:in `run'
/usr/local/Homebrew/Library/Homebrew/brew.rb:92:in `<main>'
Please report this issue:
  https://docs.brew.sh/Troubleshooting

Output of brew doctor and brew config

Your system is ready to brew.

HOMEBREW_VERSION: 4.3.6
ORIGIN: https://github.com/Homebrew/brew
HEAD: e8430b25a1d1321f32e5093d62b57b5cb7cfb3c3
Last commit: 7 days ago
Core tap JSON: 23 Jun 16:23 UTC
Core cask tap JSON: 23 Jun 16:23 UTC
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 12
Homebrew Ruby: 3.3.3 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.3/bin/ruby
CPU: dodeca-core 64-bit kabylake
Clang: 15.0.0 build 1500
Git: 2.39.3 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 8.6.0 => /usr/bin/curl
macOS: 14.5-x86_64
CLT: 15.3.0.0.1.1708646388
Xcode: N/A

Output of brew tap

N/A
@Rylan12 Rylan12 transferred this issue from Homebrew/homebrew-cask Jun 24, 2024
@Rylan12
Copy link
Member

Rylan12 commented Jun 24, 2024

Based on my reading of https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified, the format that is expected for the Last-Modified header is:

Last-Modified: <day-name>, <day> <month> <year> <hour>:<minute>:<second> GMT

Since 2/29/24 11:29 AM does not match this format (or, it seems, any standard format), Time.parse cannot necessarily parse it per the Time.parse docs:

If the input string does not match valid formats strictly, you may get a cryptic result

In my opinion, the issue is that secure.olex2.org is sending an invalid header value, and not really a Homebrew bug. However, maybe we should not error in this case and simply pretend as if no Last-Modified header was passed?

@MikeMcQuaid MikeMcQuaid added bug Reproducible Homebrew/brew bug help wanted We want help addressing this labels Jun 24, 2024
@MikeMcQuaid
Copy link
Member

However, maybe we should not error in this case and simply pretend as if no Last-Modified header was passed?

Yes, this makes sense to me 👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Reproducible Homebrew/brew bug help wanted We want help addressing this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants