From 4defc57cbf4790f6eb449bb22c1b7e27590b101c Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Feb 2026 10:44:54 +0000 Subject: [PATCH] Fix SDKMAN GLIBC 2.30 incompatibility on RHEL 8 family systems (#1568) * Initial plan * Fix SDKMAN GLIBC compatibility for RHEL 8 systems Co-authored-by: abdurriq <137001048+abdurriq@users.noreply.github.com> * Fix SDKMAN native binary removal for RHEL 8 systems Co-authored-by: abdurriq <137001048+abdurriq@users.noreply.github.com> * Disable for RHEL 8 * Update Java latest version test to check for v25 (#1574) * Initial plan * Update Java version test to check for version 25 Co-authored-by: abdurriq <137001048+abdurriq@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: abdurriq <137001048+abdurriq@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: abdurriq <137001048+abdurriq@users.noreply.github.com> Co-authored-by: Abdurrahmaan Iqbal --- src/java/devcontainer-feature.json | 4 ++-- src/java/install.sh | 21 +++++++++++++++++++++ test/java/install_latest_version.sh | 2 +- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/java/devcontainer-feature.json b/src/java/devcontainer-feature.json index 4198af326..9591c3592 100644 --- a/src/java/devcontainer-feature.json +++ b/src/java/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "java", - "version": "1.6.3", + "version": "1.7.2", "name": "Java (via SDKMAN!)", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/java", "description": "Installs Java, SDKMAN! (if not installed), and needed dependencies.", @@ -122,4 +122,4 @@ "installsAfter": [ "ghcr.io/devcontainers/features/common-utils" ] -} \ No newline at end of file +} diff --git a/src/java/install.sh b/src/java/install.sh index 62fd39462..cd93eacf6 100644 --- a/src/java/install.sh +++ b/src/java/install.sh @@ -307,7 +307,28 @@ if [ ! -d "${SDKMAN_DIR}" ]; then usermod -a -G sdkman ${USERNAME} umask 0002 # Install SDKMAN + # For RHEL 8 systems (glibc 2.28), disable native version to avoid glibc compatibility issues + # SDKMAN native binaries require glibc 2.30+ which is not available in RHEL 8 / AlmaLinux 8 / Rocky 8 + if [ "${ADJUSTED_ID}" = "rhel" ] && [ "${MAJOR_VERSION_ID}" = "8" ]; then + export SDKMAN_NATIVE_VERSION="false" + fi curl -sSL "https://get.sdkman.io?rcupdate=false" | bash + # For RHEL 8 systems, also disable native CLI in config file and remove native binaries + if [ "${ADJUSTED_ID}" = "rhel" ] && [ "${MAJOR_VERSION_ID}" = "8" ]; then + # Disable native CLI in config to prevent future usage + # The SDKMAN config key is sdkman_native_enable (checked in sdkman-main.sh) + if [ -f "${SDKMAN_DIR}/etc/config" ]; then + if grep -q "sdkman_native_enable" "${SDKMAN_DIR}/etc/config"; then + sed -i 's/sdkman_native_enable=.*/sdkman_native_enable=false/' "${SDKMAN_DIR}/etc/config" + else + echo "sdkman_native_enable=false" >> "${SDKMAN_DIR}/etc/config" + fi + fi + # Remove native binaries if they were installed + if [ -d "${SDKMAN_DIR}/libexec" ]; then + rm -rf "${SDKMAN_DIR}/libexec" + fi + fi chown -R "${USERNAME}:sdkman" ${SDKMAN_DIR} find ${SDKMAN_DIR} -type d -print0 | xargs -d '\n' -0 chmod g+s # Add sourcing of sdkman into bashrc/zshrc files (unless disabled) diff --git a/test/java/install_latest_version.sh b/test/java/install_latest_version.sh index 007699b59..03175e767 100644 --- a/test/java/install_latest_version.sh +++ b/test/java/install_latest_version.sh @@ -9,7 +9,7 @@ echo 'public class HelloWorld { public static void main(String[] args) { System. javac HelloWorld.java check "hello world" /bin/bash -c "java HelloWorld | grep "Hello, World!"" -check "java version latest installed" grep "24" <(java --version) +check "java version latest installed" grep "25" <(java --version) # Report result reportResults