Skip to content

Commit fa03710

Browse files
Copilotabdurriq
andauthored
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 <[email protected]> * Fix SDKMAN native binary removal for RHEL 8 systems Co-authored-by: abdurriq <[email protected]> * 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 <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: abdurriq <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: abdurriq <[email protected]> Co-authored-by: Abdurrahmaan Iqbal <[email protected]>
1 parent 3f0dee2 commit fa03710

3 files changed

Lines changed: 23 additions & 2 deletions

File tree

src/java/devcontainer-feature.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "java",
3-
"version": "1.7.0",
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.",

src/java/install.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,28 @@ if [ ! -d "${SDKMAN_DIR}" ]; then
297297
usermod -a -G sdkman ${USERNAME}
298298
umask 0002
299299
# Install SDKMAN
300+
# For RHEL 8 systems (glibc 2.28), disable native version to avoid glibc compatibility issues
301+
# SDKMAN native binaries require glibc 2.30+ which is not available in RHEL 8 / AlmaLinux 8 / Rocky 8
302+
if [ "${ADJUSTED_ID}" = "rhel" ] && [ "${MAJOR_VERSION_ID}" = "8" ]; then
303+
export SDKMAN_NATIVE_VERSION="false"
304+
fi
300305
curl -sSL "https://get.sdkman.io?rcupdate=false" | bash
306+
# For RHEL 8 systems, also disable native CLI in config file and remove native binaries
307+
if [ "${ADJUSTED_ID}" = "rhel" ] && [ "${MAJOR_VERSION_ID}" = "8" ]; then
308+
# Disable native CLI in config to prevent future usage
309+
# The SDKMAN config key is sdkman_native_enable (checked in sdkman-main.sh)
310+
if [ -f "${SDKMAN_DIR}/etc/config" ]; then
311+
if grep -q "sdkman_native_enable" "${SDKMAN_DIR}/etc/config"; then
312+
sed -i 's/sdkman_native_enable=.*/sdkman_native_enable=false/' "${SDKMAN_DIR}/etc/config"
313+
else
314+
echo "sdkman_native_enable=false" >> "${SDKMAN_DIR}/etc/config"
315+
fi
316+
fi
317+
# Remove native binaries if they were installed
318+
if [ -d "${SDKMAN_DIR}/libexec" ]; then
319+
rm -rf "${SDKMAN_DIR}/libexec"
320+
fi
321+
fi
301322
chown -R "${USERNAME}:sdkman" ${SDKMAN_DIR}
302323
find ${SDKMAN_DIR} -type d -print0 | xargs -d '\n' -0 chmod g+s
303324
# 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)