Compare commits

..

5 commits

Author SHA1 Message Date
Hiroshi SHIBATA
7e6d7f1653
ruby-build 20260512 2026-05-12 09:31:59 +09:00
GitHub Actions Bot
60d0948d06 Added 4.0.4 with OpenSSL 3.0.20 2026-05-11 21:27:21 +00:00
Benoit Daloze
17c061e067 ruby-build 20260503 2026-05-03 16:14:36 +02:00
Benoit Daloze
b0a21cdfce
Merge pull request #2621 from amatsuda/fix-resolve-version-ruby-prefix
Fix definition lookup for ruby-prefixed names like `ruby-dev`
2026-05-03 16:13:58 +02:00
Akira Matsuda
e98dffb562
Fix definition lookup for ruby-prefixed names like ruby-dev
`resolve_version` strips the leading `ruby-` from its argument and
then only looks for the stripped form in the definitions directory.
For canonical definitions whose filename retains the `ruby-` prefix
(currently `ruby-dev`) the exact-match step searches for `dev`,
which does not exist, and the grep fallback's `^dev[-.]` anchor
also misses the `ruby-dev` line in the definitions list. Result:
`ruby-build ruby-dev` reports "definition not found" even though
the file is shipped.

Try the original (unstripped) argument first in the exact-match
loop, then fall back to the stripped form. Numeric-version inputs
(`ruby-3.4.9`, `3.4`, `ruby-3.4`) and other implementations
(`mruby-dev`, `jruby-dev`) are unaffected because their existing
code paths still match.

Regression introduced in #2610.
2026-05-03 22:16:26 +09:00
4 changed files with 20 additions and 4 deletions

View file

@ -18,7 +18,7 @@
# -6, --ipv6 Resolve names to IPv6 addresses only # -6, --ipv6 Resolve names to IPv6 addresses only
# #
RUBY_BUILD_VERSION="20260501" RUBY_BUILD_VERSION="20260512"
OLDIFS="$IFS" OLDIFS="$IFS"
@ -1420,6 +1420,10 @@ resolve_version() {
# Look for an exact match first. # Look for an exact match first.
for DEFINITION_DIR in "${RUBY_BUILD_DEFINITIONS[@]}"; do for DEFINITION_DIR in "${RUBY_BUILD_DEFINITIONS[@]}"; do
if [ -f "${DEFINITION_DIR}/$1" ]; then
echo "$1"
return 0
fi
if [ -f "${DEFINITION_DIR}/${version}" ]; then if [ -f "${DEFINITION_DIR}/${version}" ]; then
echo "$version" echo "$version"
return 0 return 0

View file

@ -2,12 +2,12 @@
.\" Title: ruby-build .\" Title: ruby-build
.\" Author: Mislav Marohnić .\" Author: Mislav Marohnić
.\" Generator: Asciidoctor 2.0.26 .\" Generator: Asciidoctor 2.0.26
.\" Date: 2026-05-01 .\" Date: 2026-05-07
.\" Manual: ruby-build Manual .\" Manual: ruby-build Manual
.\" Source: ruby-build 20260501 .\" Source: ruby-build 20260512
.\" Language: English .\" Language: English
.\" .\"
.TH "RUBY\-BUILD" "1" "2026-05-01" "ruby\-build 20260501" "ruby\-build Manual" .TH "RUBY\-BUILD" "1" "2026-05-07" "ruby\-build 20260512" "ruby\-build Manual"
.ie \n(.g .ds Aq \(aq .ie \n(.g .ds Aq \(aq
.el .ds Aq ' .el .ds Aq '
.ss \n[.ss] 0 .ss \n[.ss] 0

2
share/ruby-build/4.0.4 Normal file
View file

@ -0,0 +1,2 @@
install_package "openssl-3.0.20" "https://github.com/openssl/openssl/releases/download/openssl-3.0.20/openssl-3.0.20.tar.gz#c80a01dfc70ece4dc21168932c37739042d404d46ccc81a5986dd75314ecda6f" openssl --if needs_openssl:1.1.1-3.x.x
install_package "ruby-4.0.4" "https://cache.ruby-lang.org/pub/ruby/4.0/ruby-4.0.4.tar.gz#f35f6edfa3dabb3f723f9d0cf1906c6512ae77f4e412ab1e68cc6e91d230fa80" enable_shared standard

View file

@ -113,6 +113,16 @@ NUM_DEFINITIONS="$(ls "$BATS_TEST_DIRNAME"/../share/ruby-build | wc -l)"
assert_success "3.2.1" assert_success "3.2.1"
} }
@test "resolve definition by exact match for ruby-prefixed name" {
export RUBY_BUILD_DEFINITIONS="${TMP}/definitions"
mkdir -p "${TMP}/definitions"
touch "${TMP}/definitions/ruby-dev"
run bin/ruby-build --resolve "ruby-dev"
assert_success "ruby-dev"
}
@test "resolve definition with ruby prefix" { @test "resolve definition with ruby prefix" {
export RUBY_BUILD_DEFINITIONS="${TMP}/definitions" export RUBY_BUILD_DEFINITIONS="${TMP}/definitions"
mkdir -p "${TMP}/definitions" mkdir -p "${TMP}/definitions"