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

Pengfei Li Pengfei.Li at arm.com
Thu Jun 21 10:57:40 UTC 2018


Hi Bernard,

Yes, your fix is good but would be nicer if the comment in line 733 is modified as well since it might be misleading.
>  733     /* On AIX, readdir() returns EBADF ...

I only have Linux machines to test. But I suggest that your patch being merged soon as the deprecated use breaks the build on many latest Linux distributions, and it's hard for guys to find other POSIX platforms in a short time.

--
Thanks,
Pengfei


-----Original Message-----
From: B. Blaser <bsrbnd at gmail.com> 
Sent: Thursday, June 21, 2018 00:01
To: Pengfei Li <Pengfei.Li at arm.com>
Cc: kim.barrett at oracle.com; core-libs-dev at openjdk.java.net; nd <nd at arm.com>; build-dev at openjdk.java.net
Subject: Re: RFR: 8179887 - Build failure with glibc >= 2.24: error: 'int readdir_r(DIR*, dirent*, dirent**)' is deprecated

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