RFR: 8202794: Native Unix code should use readdir rather than readdir_r
Hi Last month, Bernard proposed a patch to fix the OpenJDK build issue with recent versions of glibc. See http://mail.openjdk.java.net/pipermail/core-libs-dev/2018-May/052991.html But this fix requires to be tested on all POSIX systems before getting integrated. As recently, more and more guys are complaining about the OpenJDK build failure issue, shall we just add the following workaround to upstream before Bernard's real fix eventually merged? diff --git a/src/java.base/unix/native/libjava/TimeZone_md.c b/src/java.base/unix/native/libjava/TimeZone_md.c index f0bb362afc..e156381acd 100644 --- a/src/java.base/unix/native/libjava/TimeZone_md.c +++ b/src/java.base/unix/native/libjava/TimeZone_md.c @@ -146,7 +146,7 @@ findZoneinfoFile(char *buf, size_t size, const char *dir) (void) closedir(dirp); return NULL; } - +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" while (readdir64_r(dirp, entry, &dp) == 0 && dp != NULL) { /* * Skip '.' and '..' (and possibly other .* files) diff --git a/src/java.base/unix/native/libjava/UnixFileSystem_md.c b/src/java.base/unix/native/libjava/UnixFileSystem_md.c index 315aa92b64..5b9554dd47 100644 --- a/src/java.base/unix/native/libjava/UnixFileSystem_md.c +++ b/src/java.base/unix/native/libjava/UnixFileSystem_md.c @@ -339,6 +339,7 @@ Java_java_io_UnixFileSystem_list(JNIEnv *env, jobject this, if (rv == NULL) goto error; /* Scan the directory */ +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" while ((readdir64_r(dir, ptr, &result) == 0) && (result != NULL)) { jstring name; if (!strcmp(ptr->d_name, ".") || !strcmp(ptr->d_name, "..")) diff --git a/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c b/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c index 53bb1c1009..72c38eb9a6 100644 --- a/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c +++ b/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c @@ -731,6 +731,7 @@ Java_sun_nio_fs_UnixNativeDispatcher_readdir(JNIEnv* env, jclass this, jlong val /* EINTR not listed as a possible error */ /* TDB: reentrant version probably not required here */ +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" res = readdir64_r(dirp, ptr, &result); #ifdef _AIX diff --git a/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c b/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c index 1adeaf7bb5..080cf2a89b 100644 --- a/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c +++ b/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c @@ -80,6 +80,7 @@ static struct dirent* read_dir(DIR* dirp, struct dirent* entry) { return dbuf; #else /* __linux__ || _ALLBSD_SOURCE */ struct dirent* p; +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" if (readdir_r(dirp, entry, &p) == 0) { return p; } else { -- Thanks, Pengfei
Hey, all; did this get resolved? I'm still getting this error in pulled-yesterday clones of jdk8u and jdk9 and jdk10. I would prefer not to make local changes (mostly I want to build debug builds so I can spelunk the JVM bits), but if this isn't going to roll out fairly shortly I'll disable warnings-as-errors and carry on. Ted Neward Technologist and Leader T: @tedneward | M: (425) 647-4526 http://www.newardassociates.com -----Original Message----- From: build-dev <build-dev-bounces@openjdk.java.net> On Behalf Of Pengfei Li Sent: Thursday, June 28, 2018 3:01 AM To: kim.barrett@oracle.com; bsrbnd@gmail.com Cc: build-dev@openjdk.java.net; nd <nd@arm.com>; core-libs-dev@openjdk.java.net Subject: RFR: 8202794: Native Unix code should use readdir rather than readdir_r Hi Last month, Bernard proposed a patch to fix the OpenJDK build issue with recent versions of glibc. See http://mail.openjdk.java.net/pipermail/core-libs-dev/2018-May/052991.html But this fix requires to be tested on all POSIX systems before getting integrated. As recently, more and more guys are complaining about the OpenJDK build failure issue, shall we just add the following workaround to upstream before Bernard's real fix eventually merged? diff --git a/src/java.base/unix/native/libjava/TimeZone_md.c b/src/java.base/unix/native/libjava/TimeZone_md.c index f0bb362afc..e156381acd 100644 --- a/src/java.base/unix/native/libjava/TimeZone_md.c +++ b/src/java.base/unix/native/libjava/TimeZone_md.c @@ -146,7 +146,7 @@ findZoneinfoFile(char *buf, size_t size, const char *dir) (void) closedir(dirp); return NULL; } - +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" while (readdir64_r(dirp, entry, &dp) == 0 && dp != NULL) { /* * Skip '.' and '..' (and possibly other .* files) diff --git a/src/java.base/unix/native/libjava/UnixFileSystem_md.c b/src/java.base/unix/native/libjava/UnixFileSystem_md.c index 315aa92b64..5b9554dd47 100644 --- a/src/java.base/unix/native/libjava/UnixFileSystem_md.c +++ b/src/java.base/unix/native/libjava/UnixFileSystem_md.c @@ -339,6 +339,7 @@ Java_java_io_UnixFileSystem_list(JNIEnv *env, jobject this, if (rv == NULL) goto error; /* Scan the directory */ +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" while ((readdir64_r(dir, ptr, &result) == 0) && (result != NULL)) { jstring name; if (!strcmp(ptr->d_name, ".") || !strcmp(ptr->d_name, "..")) diff --git a/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c b/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c index 53bb1c1009..72c38eb9a6 100644 --- a/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c +++ b/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c @@ -731,6 +731,7 @@ Java_sun_nio_fs_UnixNativeDispatcher_readdir(JNIEnv* env, jclass this, jlong val /* EINTR not listed as a possible error */ /* TDB: reentrant version probably not required here */ +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" res = readdir64_r(dirp, ptr, &result); #ifdef _AIX diff --git a/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c b/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c index 1adeaf7bb5..080cf2a89b 100644 --- a/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c +++ b/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemIm +++ pl.c @@ -80,6 +80,7 @@ static struct dirent* read_dir(DIR* dirp, struct dirent* entry) { return dbuf; #else /* __linux__ || _ALLBSD_SOURCE */ struct dirent* p; +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" if (readdir_r(dirp, entry, &p) == 0) { return p; } else { -- Thanks, Pengfei
On 03/08/2018 20:26, ted@tedneward.com wrote:
Hey, all; did this get resolved? I'm still getting this error in pulled-yesterday clones of jdk8u and jdk9 and jdk10. I would prefer not to make local changes (mostly I want to build debug builds so I can spelunk the JVM bits), but if this isn't going to roll out fairly shortly I'll disable warnings-as-errors and carry on.
The changes for JDK-8202353, JDK-8202794, and JDK-8207340 are in jdk/jdk for JDK 12. There are few residual issues/inconsistencies that came up and are still under discussion on the mailing lists. I don't think there has been any discussion yet about back porting. -Alan
Assuming I want to build JDK 8/9/10/11 (for research and spelunking purposes), what's the best way to do that if the changes aren't going to be backported? Turn off the warnings-as-errors (and what's the best way to do that), or somehow downgrade glibc (on my Ubuntu 18 image)? I could use advice/assistance on either approach. Ted Neward Technologist and Leader T: @tedneward | M: (425) 647-4526 http://www.newardassociates.com -----Original Message----- From: Alan Bateman <Alan.Bateman@oracle.com> Sent: Sunday, August 5, 2018 11:08 AM To: ted@tedneward.com; 'Pengfei Li' <Pengfei.Li@arm.com>; kim.barrett@oracle.com; bsrbnd@gmail.com Cc: build-dev@openjdk.java.net; 'nd' <nd@arm.com>; core-libs-dev@openjdk.java.net Subject: Re: 8202794: Native Unix code should use readdir rather than readdir_r On 03/08/2018 20:26, ted@tedneward.com wrote:
Hey, all; did this get resolved? I'm still getting this error in pulled-yesterday clones of jdk8u and jdk9 and jdk10. I would prefer not to make local changes (mostly I want to build debug builds so I can spelunk the JVM bits), but if this isn't going to roll out fairly shortly I'll disable warnings-as-errors and carry on.
The changes for JDK-8202353, JDK-8202794, and JDK-8207340 are in jdk/jdk for JDK 12. There are few residual issues/inconsistencies that came up and are still under discussion on the mailing lists. I don't think there has been any discussion yet about back porting. -Alan
Ted, I just use --disable-warnings-as-errors in bash configure command to build jdk 10/11 on Ubuntu 18. -- Thanks, Pengfei
Assuming I want to build JDK 8/9/10/11 (for research and spelunking purposes), what's the best way to do that if the changes aren't going to be backported? Turn off the warnings-as-errors (and what's the best way to do that), or somehow downgrade glibc (on my Ubuntu 18 image)? I could use advice/assistance on either approach.
Ted Neward Technologist and Leader T: @tedneward | M: (425) 647-4526 http://www.newardassociates.com
-----Original Message----- From: Alan Bateman <Alan.Bateman@oracle.com> Sent: Sunday, August 5, 2018 11:08 AM To: ted@tedneward.com; 'Pengfei Li' <Pengfei.Li@arm.com>; kim.barrett@oracle.com; bsrbnd@gmail.com Cc: build-dev@openjdk.java.net; 'nd' <nd@arm.com>; core-libs- dev@openjdk.java.net Subject: Re: 8202794: Native Unix code should use readdir rather than readdir_r
On 03/08/2018 20:26, ted@tedneward.com wrote:
Hey, all; did this get resolved? I'm still getting this error in pulled-yesterday clones of jdk8u and jdk9 and jdk10. I would prefer not to make local changes (mostly I want to build debug builds so I can spelunk the JVM bits), but if this isn't going to roll out fairly shortly I'll disable warnings-as-errors and carry on.
The changes for JDK-8202353, JDK-8202794, and JDK-8207340 are in jdk/jdk for JDK 12. There are few residual issues/inconsistencies that came up and are still under discussion on the mailing lists. I don't think there has been any discussion yet about back porting.
-Alan
Well, that works for JDK 10, it seems... (building now...) but is there a similar way to disable warnings for JDK 8 and 9? Some combination of CFLAGS/CPPFLAGS, perhaps? I'd really like to be able to build 8 and 9; particularly 8, since that's what my current employer is still using. :-) Ted Neward Technologist and Leader T: @tedneward | M: (425) 647-4526 http://www.newardassociates.com -----Original Message----- From: Pengfei Li <Pengfei.Li@arm.com> Sent: Sunday, August 5, 2018 11:26 PM To: ted@tedneward.com; 'Alan Bateman' <Alan.Bateman@oracle.com>; kim.barrett@oracle.com; bsrbnd@gmail.com Cc: build-dev@openjdk.java.net; nd <nd@arm.com>; core-libs-dev@openjdk.java.net Subject: RE: 8202794: Native Unix code should use readdir rather than readdir_r Ted, I just use --disable-warnings-as-errors in bash configure command to build jdk 10/11 on Ubuntu 18. -- Thanks, Pengfei
Assuming I want to build JDK 8/9/10/11 (for research and spelunking purposes), what's the best way to do that if the changes aren't going to be backported? Turn off the warnings-as-errors (and what's the best way to do that), or somehow downgrade glibc (on my Ubuntu 18 image)? I could use advice/assistance on either approach.
Ted Neward Technologist and Leader T: @tedneward | M: (425) 647-4526 http://www.newardassociates.com
-----Original Message----- From: Alan Bateman <Alan.Bateman@oracle.com> Sent: Sunday, August 5, 2018 11:08 AM To: ted@tedneward.com; 'Pengfei Li' <Pengfei.Li@arm.com>; kim.barrett@oracle.com; bsrbnd@gmail.com Cc: build-dev@openjdk.java.net; 'nd' <nd@arm.com>; core-libs- dev@openjdk.java.net Subject: Re: 8202794: Native Unix code should use readdir rather than readdir_r
On 03/08/2018 20:26, ted@tedneward.com wrote:
Hey, all; did this get resolved? I'm still getting this error in pulled-yesterday clones of jdk8u and jdk9 and jdk10. I would prefer not to make local changes (mostly I want to build debug builds so I can spelunk the JVM bits), but if this isn't going to roll out fairly shortly I'll disable warnings-as-errors and carry on.
The changes for JDK-8202353, JDK-8202794, and JDK-8207340 are in jdk/jdk for JDK 12. There are few residual issues/inconsistencies that came up and are still under discussion on the mailing lists. I don't think there has been any discussion yet about back porting.
-Alan
On Mon, 2018-08-06 at 01:32 -0700, ted@tedneward.com wrote:
I'd really like to be able to build 8 and 9; particularly 8, since that's what my current employer is still using. :-)
For JDK 8 we have to use: $ bash configure ... $ make WARNINGS_ARE_ERRORS="" \ SCTP_WERROR= \ ... JDK 9+ have --disable-warnings-as-errors configure option. Thanks, Severin
Giving that a spin now; thanks! Ted Neward Technologist and Leader T: @tedneward | M: (425) 647-4526 http://www.newardassociates.com -----Original Message----- From: Severin Gehwolf <sgehwolf@redhat.com> Sent: Monday, August 6, 2018 1:46 AM To: ted@tedneward.com; 'Pengfei Li' <Pengfei.Li@arm.com>; 'Alan Bateman' <Alan.Bateman@oracle.com>; kim.barrett@oracle.com; bsrbnd@gmail.com Cc: build-dev@openjdk.java.net; 'nd' <nd@arm.com>; core-libs-dev@openjdk.java.net Subject: Re: 8202794: Native Unix code should use readdir rather than readdir_r On Mon, 2018-08-06 at 01:32 -0700, ted@tedneward.com wrote:
I'd really like to be able to build 8 and 9; particularly 8, since that's what my current employer is still using. :-)
For JDK 8 we have to use: $ bash configure ... $ make WARNINGS_ARE_ERRORS="" \ SCTP_WERROR= \ ... JDK 9+ have --disable-warnings-as-errors configure option. Thanks, Severin
And forgot to lead with: Thanks, Pengfei! That helps a great deal. Ted Neward Technologist and Leader T: @tedneward | M: (425) 647-4526 http://www.newardassociates.com -----Original Message----- From: Pengfei Li <Pengfei.Li@arm.com> Sent: Sunday, August 5, 2018 11:26 PM To: ted@tedneward.com; 'Alan Bateman' <Alan.Bateman@oracle.com>; kim.barrett@oracle.com; bsrbnd@gmail.com Cc: build-dev@openjdk.java.net; nd <nd@arm.com>; core-libs-dev@openjdk.java.net Subject: RE: 8202794: Native Unix code should use readdir rather than readdir_r Ted, I just use --disable-warnings-as-errors in bash configure command to build jdk 10/11 on Ubuntu 18. -- Thanks, Pengfei
Assuming I want to build JDK 8/9/10/11 (for research and spelunking purposes), what's the best way to do that if the changes aren't going to be backported? Turn off the warnings-as-errors (and what's the best way to do that), or somehow downgrade glibc (on my Ubuntu 18 image)? I could use advice/assistance on either approach.
Ted Neward Technologist and Leader T: @tedneward | M: (425) 647-4526 http://www.newardassociates.com
-----Original Message----- From: Alan Bateman <Alan.Bateman@oracle.com> Sent: Sunday, August 5, 2018 11:08 AM To: ted@tedneward.com; 'Pengfei Li' <Pengfei.Li@arm.com>; kim.barrett@oracle.com; bsrbnd@gmail.com Cc: build-dev@openjdk.java.net; 'nd' <nd@arm.com>; core-libs- dev@openjdk.java.net Subject: Re: 8202794: Native Unix code should use readdir rather than readdir_r
On 03/08/2018 20:26, ted@tedneward.com wrote:
Hey, all; did this get resolved? I'm still getting this error in pulled-yesterday clones of jdk8u and jdk9 and jdk10. I would prefer not to make local changes (mostly I want to build debug builds so I can spelunk the JVM bits), but if this isn't going to roll out fairly shortly I'll disable warnings-as-errors and carry on.
The changes for JDK-8202353, JDK-8202794, and JDK-8207340 are in jdk/jdk for JDK 12. There are few residual issues/inconsistencies that came up and are still under discussion on the mailing lists. I don't think there has been any discussion yet about back porting.
-Alan
participants (4)
-
Alan Bateman
-
Pengfei Li
-
Severin Gehwolf
-
ted@tedneward.com