Skip to content

Undefined variable line 723: [: : integer expression expectedΒ #2572

@nopeless

Description

@nopeless

ruby-build/bin/ruby-build

Lines 671 to 723 in d972555

if [ "$package_var_name" = "RUBY" ]; then
# shellcheck disable=SC2155
local ruby_semver="$(normalize_semver "${package_name#ruby-}")"
if [[ "$RUBY_CONFIGURE_OPTS ${RUBY_CONFIGURE_OPTS_ARRAY[*]}" != *--with-readline-dir=* && "$ruby_semver" -lt 30300 ]]; then
# Ruby 3.3+ does not need external readline: https://github.com/rbenv/ruby-build/issues/2330
use_homebrew_readline || use_freebsd_readline || true
fi
if [[ "$RUBY_CONFIGURE_OPTS ${RUBY_CONFIGURE_OPTS_ARRAY[*]}" != *--with-libffi-dir=* ]]; then
use_freebsd_libffi || true
fi
if [[ "$RUBY_CONFIGURE_OPTS ${RUBY_CONFIGURE_OPTS_ARRAY[*]}" != *--with-libyaml-dir=* ]]; then
use_homebrew_yaml || use_freebsd_yaml || true
fi
if [[ "$RUBY_CONFIGURE_OPTS ${RUBY_CONFIGURE_OPTS_ARRAY[*]}" != *--with-gmp-dir=* ]]; then
use_homebrew_gmp || true
fi
if [[ "$RUBY_CONFIGURE_OPTS ${RUBY_CONFIGURE_OPTS_ARRAY[*]}" != *--with-openssl-dir=* ]]; then
if is_freebsd && [ -f /usr/local/include/openssl/ssl.h ]; then
# use openssl installed from Ports Collection
package_option ruby configure --with-openssl-dir="/usr/local"
fi
elif [ "$ruby_semver" -lt 20707 ]; then
local opt
for opt in $RUBY_CONFIGURE_OPTS "${RUBY_CONFIGURE_OPTS_ARRAY[@]}"; do
if [[ $opt == --with-openssl-dir=* ]]; then
# Ruby < 2.7.7 are known to prioritize the result of `pkg-config --libs openssl`
# over the directory explicitly supplied by "--with-openssl-dir". This can cause
# issues if an incompatible OpenSSL version is found in pkg-config search path.
# https://github.com/ruby/openssl/pull/486
#
# The workaround is to adjust the search path to prioritize the location supplied
# in "--with-openssl-dir".
export PKG_CONFIG_PATH="${opt#--with-openssl-dir=}/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
break
fi
done
fi
if [[ "$RUBY_CONFIGURE_OPTS ${RUBY_CONFIGURE_OPTS_ARRAY[*]}" != *--with-ext* &&
"$RUBY_CONFIGURE_OPTS ${RUBY_CONFIGURE_OPTS_ARRAY[*]}" != *--without-ext* &&
"$ruby_semver" -ge 20500 ]]; then
# For Ruby 2.5+, fail the `make` step if any of these extensions were not compiled.
# Otherwise, the build would have succeeded, but Ruby would be useless at runtime.
# https://github.com/ruby/ruby/commit/b58a30e1c14e971adba4096104274d5d692492e9
package_option ruby configure --with-ext=openssl,psych,+
fi
fi
( if [ "${CFLAGS+defined}" ] || [ "${!PACKAGE_CFLAGS+defined}" ]; then
export CFLAGS="$CFLAGS ${!PACKAGE_CFLAGS}"
fi
if [ -z "$CC" ] && is_mac 1010; then
export CC=clang
elif [ "$ruby_semver" -lt 30200 ] && is_fedora 42; then

Line 672 does not execute unconditionally, so if package_var_name is not RUBY it errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions