Skip to content

Commit c4d1db0

Browse files
abdurriqCopilot
andauthored
Fix SDKMAN GLIBC 2.30 incompatibility on RHEL 8 family systems (#1575)
Fix SDKMAN GLIBC 2.30 incompatibility on RHEL 8 family systems (#1568) * Initial plan * Fix SDKMAN GLIBC compatibility for RHEL 8 systems * Fix SDKMAN native binary removal for RHEL 8 systems * 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: Copilot <198982749+Copilot@users.noreply.github.com>
1 parent 4ed1c6d commit c4d1db0

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

src/java/devcontainer-feature.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "java",
3-
"version": "1.6.3",
3+
"version": "1.7.2",
44
"name": "Java (via SDKMAN!)",
55
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/java",
66
"description": "Installs Java, SDKMAN! (if not installed), and needed dependencies.",
@@ -122,4 +122,4 @@
122122
"installsAfter": [
123123
"ghcr.io/devcontainers/features/common-utils"
124124
]
125-
}
125+
}

src/java/install.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,28 @@ if [ ! -d "${SDKMAN_DIR}" ]; then
307307
usermod -a -G sdkman ${USERNAME}
308308
umask 0002
309309
# Install SDKMAN
310+
# For RHEL 8 systems (glibc 2.28), disable native version to avoid glibc compatibility issues
311+
# SDKMAN native binaries require glibc 2.30+ which is not available in RHEL 8 / AlmaLinux 8 / Rocky 8
312+
if [ "${ADJUSTED_ID}" = "rhel" ] && [ "${MAJOR_VERSION_ID}" = "8" ]; then
313+
export SDKMAN_NATIVE_VERSION="false"
314+
fi
310315
curl -sSL "https://get.sdkman.io?rcupdate=false" | bash
316+
# For RHEL 8 systems, also disable native CLI in config file and remove native binaries
317+
if [ "${ADJUSTED_ID}" = "rhel" ] && [ "${MAJOR_VERSION_ID}" = "8" ]; then
318+
# Disable native CLI in config to prevent future usage
319+
# The SDKMAN config key is sdkman_native_enable (checked in sdkman-main.sh)
320+
if [ -f "${SDKMAN_DIR}/etc/config" ]; then
321+
if grep -q "sdkman_native_enable" "${SDKMAN_DIR}/etc/config"; then
322+
sed -i 's/sdkman_native_enable=.*/sdkman_native_enable=false/' "${SDKMAN_DIR}/etc/config"
323+
else
324+
echo "sdkman_native_enable=false" >> "${SDKMAN_DIR}/etc/config"
325+
fi
326+
fi
327+
# Remove native binaries if they were installed
328+
if [ -d "${SDKMAN_DIR}/libexec" ]; then
329+
rm -rf "${SDKMAN_DIR}/libexec"
330+
fi
331+
fi
311332
chown -R "${USERNAME}:sdkman" ${SDKMAN_DIR}
312333
find ${SDKMAN_DIR} -type d -print0 | xargs -d '\n' -0 chmod g+s
313334
# Add sourcing of sdkman into bashrc/zshrc files (unless disabled)

test/java/install_latest_version.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ echo 'public class HelloWorld { public static void main(String[] args) { System.
99
javac HelloWorld.java
1010

1111
check "hello world" /bin/bash -c "java HelloWorld | grep "Hello, World!""
12-
check "java version latest installed" grep "24" <(java --version)
12+
check "java version latest installed" grep "25" <(java --version)
1313

1414
# Report result
1515
reportResults

0 commit comments

Comments
 (0)