rbenv / ruby-build

A tool to download, compile, and install Ruby on Unix-like systems.
https://rbenv.org/man/ruby-build.1
MIT License
3.89k stars 785 forks source link

RUBY_BUILD_MIRROR_URL ignored #2360

Closed glyh closed 8 months ago

glyh commented 8 months ago

Steps to reproduce the behavior

RUBY_BUILD_SKIP_MIRROR= RUBY_BUILD_MIRROR_URL=https://cache.ruby-china.com asdf install ruby

Expected vs. actual behavior

Expected using mirrors, but didn't

Logs

==> Downloading ruby-3.3.0.tar.gz...
-> aria2c --allow-overwrite=true --no-conf=true --console-log-level=warn --stderr -o ruby-3.3.0.tar.gz https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.0.tar.gz
[#63f0bd 0B/0B CN:1 DL:0B]            
glyh commented 8 months ago

Also opened as https://github.com/asdf-vm/asdf-ruby/issues/272

mislav commented 8 months ago

Hi, could you verify that your system has utilities to compute a SHA256 checksum? This is a prerequisite for using mirrors https://github.com/rbenv/ruby-build/blob/89d30cf33883ff579f968dc6470783ed155338b0/bin/ruby-build#L1514-L1516

The system needs to have one of shasum, sha256sum, or openssl. https://github.com/rbenv/ruby-build/blob/89d30cf33883ff579f968dc6470783ed155338b0/bin/ruby-build#L311-L320

glyh commented 8 months ago

image

mislav commented 8 months ago

Thanks for checking. Finally, can you verify that shasum process exits with a "success" status?

shasum -a 256 -b <<<"test" && echo SUCCESS

Other than that, I have no idea why your RUBY_BUILD_MIRROR_URL setting was ignored.

glyh commented 8 months ago

image

My default shell is fish, does that matter?

mislav commented 8 months ago

Thanks for checking. No, your default shell being fish should not negatively affect ruby-build functionality.

I think I found out what is the problem: your mirror setting isn't ignored, but the resource wasn't found on the mirror URL:

$ curl -f https://cache.ruby-china.com/96518814d9832bece92a85415a819d4893b307db5921ae1f0f751a9a89a56b7d
curl: (22) The requested URL returned error: 404

In that case, ruby-build downloads the file from the original location at https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.0.tar.gz. What was likely confusing for you is that the attempt to hit the mirror isn't reflected in any ruby-build output.

See here for more information about ruby-build mirrors.

glyh commented 8 months ago

That seems to be the case, thanks!