RFR: 8179887 - Build failure with glibc >= 2.24: error: 'int readdir_r(DIR*, dirent*, dirent**)' is deprecated

B. Blaser bsrbnd at gmail.com
Wed Jun 20 16:01:18 UTC 2018


Hi Pengfei,

On 20 June 2018 at 12:08, Pengfei Li <Pengfei.Li at arm.com> wrote:
> Hi
>
> I have tried the patch ( http://mail.openjdk.java.net/pipermail/core-libs-dev/2018-May/052991.html ) on Ubuntu 18.04 machines (x86_64 & aarch64) with glibc=2.26.1 and build is OK.
>
> There's a small issue within the following code in src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c
> Unlike readdir_r(), readdir() does not return int value. The value of res is always 0 before #ifdef.
>
>  727     /* EINTR not listed as a possible error */
>  728     errno = 0;
>  729     ptr = readdir64(dirp);
>  730     res = errno;
>  731
>  732 #ifdef _AIX
>  733     /* On AIX, readdir() returns EBADF (i.e. '9') and sets 'result' to NULL for the */
>  734     /* directory stream end. Otherwise, 'errno' will contain the error code. */
>  735     if (res != 0) {
>  736         res = (ptr == NULL && res == EBADF) ? 0 : errno;
>  737     }
>  738 #endif
>
> May I know that if this core-libs change going to be merged recently, or more platforms needs to be explored?
>
> --
> Thanks,
> Pengfei

Thanks for evaluating this patch, 'readdir()' doesn't return an 'int'
value but it sets 'errno' instead which is then assigned to 'res'.
So, I guess the fix is OK, or did I miss anything?

I've also tested it on Linux/x86_64 but ideally, the patch should be
tested on all supported POSIX platforms before being integrated.
The JBS issue [1] doesn't mention any fix version, so I'm not sure if
it'll be targeted to 11 or 12.

But if someone is available to test it on other POSIX platforms and
review it, this would be nice?

Thanks,
Bernard

[1] https://bugs.openjdk.java.net/browse/JDK-8202794



More information about the build-dev mailing list