From c6e0cc0dd164466fa7f71c7b50eae8647b6bca7d Mon Sep 17 00:00:00 2001 From: Andrew Hughes Date: Fri, 11 Jul 2025 00:17:38 +0100 Subject: [PATCH] Add early backport of JDK-8339414 Resolves: RHEL-97496 --- java-1.8.0-openjdk.spec | 15 ++++--- jdk8339414-fix_8202369_backport.patch | 63 +++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 6 deletions(-) create mode 100644 jdk8339414-fix_8202369_backport.patch diff --git a/java-1.8.0-openjdk.spec b/java-1.8.0-openjdk.spec index 74889aa..84d13c9 100644 --- a/java-1.8.0-openjdk.spec +++ b/java-1.8.0-openjdk.spec @@ -1605,13 +1605,14 @@ Patch15: jdk8141590-bundle_libffi-followup.patch ############################################# # -# Patches appearing in 8u382 +# Patches appearing in 8u472 # # This section includes patches which are present # in the listed OpenJDK 8u release and should be # able to be removed once that release is out # and used by this RPM. ############################################# +Patch901: jdk8339414-fix_8202369_backport.patch ############################################# @@ -2053,6 +2054,11 @@ pushd %{top_level_dir_name} %patch -P539 -p1 popd +# Upstreamed fixes +pushd %{top_level_dir_name} +%patch -P901 -p1 +popd + # RPM-only fixes %patch -P600 %patch -P1003 @@ -2970,14 +2976,11 @@ cjc.mainProgram(args) - Update to 8u462-b08 (GA) - Update release notes for 8u462-b08. - Require tzdata 2025b due to upstream inclusion of JDK-8352716 +- Add early backport of JDK-8339414 - ** This tarball is embargoed until 2025-07-15 @ 1pm PT. ** - Resolves: RHEL-101648 - Resolves: RHEL-102312 - -* Sat Jun 14 2025 Andrew Hughes - 1:1.8.0.452.b09-4 -- Bump rpmrelease for CentOS build -- Related: RHEL-86967 -- Related: RHEL-86620 +- Resolves: RHEL-97496 * Sat Jun 14 2025 Andrew Hughes - 1:1.8.0.452.b09-3 - Bump release number to appease 9.6-z erratum diff --git a/jdk8339414-fix_8202369_backport.patch b/jdk8339414-fix_8202369_backport.patch new file mode 100644 index 0000000..3250ef4 --- /dev/null +++ b/jdk8339414-fix_8202369_backport.patch @@ -0,0 +1,63 @@ +commit 51b6307937d9584f8690e4916444e479eeafff28 +Author: Thomas Fitzsimmons +Date: Mon Jun 16 23:04:07 2025 +0000 + + 8339414: Fix JDK-8202369 incorrect backport for 8u + + Reviewed-by: andrew + +diff --git a/jdk/src/solaris/native/java/net/Inet4AddressImpl.c b/jdk/src/solaris/native/java/net/Inet4AddressImpl.c +index e30851df576..8b2e3cdce93 100644 +--- a/jdk/src/solaris/native/java/net/Inet4AddressImpl.c ++++ b/jdk/src/solaris/native/java/net/Inet4AddressImpl.c +@@ -332,37 +332,33 @@ Java_java_net_Inet4AddressImpl_getHostByAddr(JNIEnv *env, jobject this, + */ + JNIEXPORT jstring JNICALL + Java_java_net_Inet4AddressImpl_getLocalHostName(JNIEnv *env, jobject this) { +- char hostname[NI_MAXHOST+1]; ++ char hostname[NI_MAXHOST + 1]; + + hostname[0] = '\0'; + if (JVM_GetHostName(hostname, sizeof(hostname))) { +- /* Something went wrong, maybe networking is not setup? */ + strcpy(hostname, "localhost"); + } else { ++#if defined(__solaris__) ++ // try to resolve hostname via nameservice ++ // if it is known but getnameinfo fails, hostname will still be the ++ // value from gethostname + struct addrinfo hints, *res; +- int error; + ++ // make sure string is null-terminated + hostname[NI_MAXHOST] = '\0'; + memset(&hints, 0, sizeof(hints)); + hints.ai_flags = AI_CANONNAME; + hints.ai_family = AF_INET; + +- error = getaddrinfo(hostname, NULL, &hints, &res); +- +- if (error == 0) {/* host is known to name service */ +- getnameinfo(res->ai_addr, +- res->ai_addrlen, +- hostname, +- NI_MAXHOST, +- NULL, +- 0, +- NI_NAMEREQD); +- +- /* if getnameinfo fails hostname is still the value +- from gethostname */ +- ++ if (getaddrinfo(hostname, NULL, &hints, &res) == 0) { ++ getnameinfo(res->ai_addr, res->ai_addrlen, hostname, NI_MAXHOST, ++ NULL, 0, NI_NAMEREQD); + freeaddrinfo(res); + } ++#else ++ // make sure string is null-terminated ++ hostname[NI_MAXHOST] = '\0'; ++#endif + } + return (*env)->NewStringUTF(env, hostname); + }