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

Pengfei Li Pengfei.Li at arm.com
Wed Jun 20 10:08:42 UTC 2018


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


> On May 7, 2018, at 11:20 AM, B. Blaser <bsrbnd at gmail.com> wrote:
>
> On 7 May 2018 at 14:19, B. Blaser <bsrbnd at gmail.com> wrote:
>> On 6 May 2018 at 18:35, B. Blaser <bsrbnd at gmail.com> wrote:
>>> On 5 May 2018 at 22:26, Kim Barrett <kim.barrett at oracle.com> wrote:
>>>>> On May 5, 2018, at 8:03 AM, B. Blaser <bsrbnd at gmail.com> wrote:
>>>>>
>>>>> On 4 May 2018 at 17:42, Alan Bateman <Alan.Bateman at oracle.com> wrote:
>>>>>> On 04/05/2018 16:31, B. Blaser wrote:
>>>>>>>
>>>>>>> :
>>>>>>>
>>>>>>> I'll create a new JBS issue (unless you want to) since the fix 
>>>>>>> is mostly located in core-libs and only intended to make the 
>>>>>>> build complete.
>>>>>>> But I'll still need someone to review and push the fix, would 
>>>>>>> you be interested in doing this?
>>>>>>>
>>>>>> I think someone needs to explore the behavior on other platforms 
>>>>>> too as the #ifndef __linux__ patches are ugly.
>>>>>
>>>>> Yes sure but I cannot test it elsewhere myself... and we can 
>>>>> easily remove them once POSIX officially deprecates 'readdir_r' or 
>>>>> if someone validates the fix on other systems.
>>>>
>>>> I'm not sure anyone has the ability to test on all supported.  That 
>>>> doesn't (and really can't) prevent making changes across platforms 
>>>> to platform-specific code.  It just means one needs to get help 
>>>> with testing.  Make the change across platforms, test on those 
>>>> platforms one has access to, and ask here for help testing on others.
>>>
>>> OK, I'll provide a cross-platform fix to be evaluated on other systems too.
>>
>> Here it is, tier1 is successful on Linux with glibc=2.26.
>> Any feedback on other systems would be very helpful.
>
> Some more cleanup…



More information about the core-libs-dev mailing list