postmodern / ruby-install

Installs Ruby, JRuby, TruffleRuby, or mruby
MIT License
1.89k stars 250 forks source link

"!!! Failed to download ruby versions!" #446

Closed veganstraightedge closed 1 year ago

veganstraightedge commented 1 year ago

Double Check

Try to Reproduce without ruby-install

# on macOS
$ ruby-install ruby 3.2.2
>>> Updating ruby versions ...
!!! Failed to download https://raw.githubusercontent.com/postmodern/ruby-versions/master/ruby/versions.txt to /Users/s/.cache/ruby-install/ruby/versions.txt!
!!! Failed to download ruby versions!

$ curl curl https://raw.githubusercontent.com/postmodern/ruby-versions/master/ruby/versions.txt

1.8.5-p115
1.8.6-p114
# [snip]
3.2.1
3.2.2

Description

When I run ruby-install ruby 3.2.2, ruby-install fails to download versions.txt.

Steps To Reproduce

Steps to reproduce the bug:

  1. $ ruby-install ruby 3.2.2

Expected Behavior

Install Ruby 3.2.2.

Actual Behavior

>>> Updating ruby versions ...
!!! Failed to download https://raw.githubusercontent.com/postmodern/ruby-versions/master/ruby/versions.txt to /Users/s/.cache/ruby-install/ruby/versions.txt!
!!! Failed to download ruby versions!

Environment

$ ruby-install --version
ruby-install: 0.9.0)

$ uname -a
Darwin lappy 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:39:35 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T8103 arm64

$ cc --version
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-darwin22.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

$ openssl version
LibreSSL 3.3.6
postmodern commented 1 year ago

I'm curious if this is reproducible, and whether it's caused by a local network issue or a GitHub infrastructure issue, or if it's really caused by how ruby-install is invoking curl or wget?

postmodern commented 1 year ago

Also, what are the versions of curl and/or wget (it might be installed, and is preferred over curl). ruby-install could be using wget instead and there could be a CA bundle issue with macOS which is causing the command to fail. I should probably change the curl vs. wget detection code to prefer curl on macOS.

ruby-install 0.9.1 will have a --debug option once it's released that will make debugging these failures a bit easier.

lazyatom commented 1 year ago

FWIW I had to upgrade wget (1.21.3 -> 1.21.3_1) to get past this error.

robinetmiller commented 1 year ago

For reference: had a similar issue today on Pop!_OS 20.04 LTS, so I doubt it's a macOS-specific thing.

$ wget --version
GNU Wget 1.20.3 built on linux-gnu.

$ ruby-install --version
ruby-install: 0.8.2

$ openssl version
OpenSSL 1.1.1f  31 Mar 2020

$ cc --version
cc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0

Manual curl responds ok for me as well.

postmodern commented 1 year ago

@robinetmiller can you try downloading the versions URL (https://raw.githubusercontent.com/postmodern/ruby-versions/master/ruby/versions.txt) using wget and see if it returns an error?

robinetmiller commented 1 year ago

Huh.

It fetches okay and now ruby-install --latest completes successfully, too. AFAIK the only thing changed was a general system APT update (none of the versions listed above are different).

Maybe it's a github service issue or TLS CA cert update?

veganstraightedge commented 1 year ago

I'm curious if this is reproducible, and whether it's caused by a local network issue or a GitHub infrastructure issue, or if it's really caused by how ruby-install is invoking curl or wget?

I'm experiencing this issue locally on my own laptop, not in an Actions workflow.

veganstraightedge commented 1 year ago

Also, what are the versions of curl and/or wget (it might be installed, and is preferred over curl). ruby-install could be using wget instead and there could be a CA bundle issue with macOS which is causing the command to fail. I should probably change the curl vs. wget detection code to prefer curl on macOS.

$ which wget

/opt/homebrew/bin/wget

$ wget --version

dyld[1015]: Library not loaded: /opt/homebrew/opt/libunistring/lib/libunistring.2.dylib

  Referenced from: <2D949429-D7EF-376D-B220-6B8E58EE1C13> /opt/homebrew/Cellar/wget/1.21.2/bin/wget

  Reason: tried: '/opt/homebrew/opt/libunistring/lib/libunistring.2.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/libunistring/lib/libunistring.2.dylib' (no such file), '/opt/homebrew/opt/libunistring/lib/libunistring.2.dylib' (no such file), '/usr/local/lib/libunistring.2.dylib' (no such file), '/usr/lib/libunistring.2.dylib' (no such file, not in dyld cache), '/opt/homebrew/Cellar/libunistring/1.1/lib/libunistring.2.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/libunistring/1.1/lib/libunistring.2.dylib' (no such file), '/opt/homebrew/Cellar/libunistring/1.1/lib/libunistring.2.dylib' (no such file), '/usr/local/lib/libunistring.2.dylib' (no such file), '/usr/lib/libunistring.2.dylib' (no such file, not in dyld cache)

Abort trap: 6

That brew installed wget situation looks Not Good™.

$ which curl

/usr/bin/curl

$ curl --version

curl 7.86.0 (x86_64-apple-darwin22.0) libcurl/7.86.0 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.11 nghttp2/1.47.0
Release-Date: 2022-10-26
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: alt-svc AsynchDNS GSS-API HSTS HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz MultiSSL NTLM NTLM_WB SPNEGO SSL threadsafe UnixSockets

ruby-install 0.9.1 will have a --debug option once it's released that will make debugging these failures a bit easier.

🎉

veganstraightedge commented 1 year ago

Uninstalling and re-installing wget (both via brew) fixed my ruby-install error.

brew uninstall wget
brew install wget

Speculation: maybe ruby-install was looking to see if wget is installed, saw that it was on my machine, tried to use it, but my install of wget was borked somehow, so ruby-install failed, but swallowed the error in a way that made it seem like ruby-install's fault instead of my wget's fault?

postmodern commented 1 year ago

This should now be fixed in ruby-install 0.9.1.