RFR: JDK-8239139 testmake fail with warning about strncpy using gcc version 8(Internet mail)

linzang(臧琳) linzang at tencent.com
Wed Feb 19 09:05:53 UTC 2020


Dear Michael, 
       Yes it compiled successfully without any warning on my machine with gcc 8.3.1.
       And thanks a lot for sponsoring.
BRs,
Lin
>Hi,
>
>I think the patch looks fine. I presume you have checked that it does
>not cause a warning with gcc 8.3.1?
>
>I will check it on other platforms and sponsor it for you.
>
>Thanks,
>
>Michael.
>
>On 19/02/2020 05:54, linzang(臧琳) wrote:
>> Thanks Vyom!
>>
>> Dear All,
>>      May I ask your help to review this tiny patch?
>>     http://cr.openjdk.java.net/~lzang/8239139/webrev02/
>>
>> Thanks,
>> Lin
>>> I am not the official OpenJDK reviewer, i think you need at least one more review.
>>> Vyom
>>>
>>> ----- Original message -----
>>> From: "linzang(臧琳)" <linzang at tencent.com>
>>> To: Vyom Tewari26 <vtewar26 at in.ibm.com>, nio-dev <nio-dev at openjdk.java.net>
>>> Cc: "linzang(臧琳)" <linzang at tencent.com>
>>> Subject: [EXTERNAL] Re: RE: RFR: JDK-8239139 testmake fail with warning about strncpy using gcc version 8(Internet mail)
>>> Date: Wed, Feb 19, 2020 7:01 AM
>>>  
>>> Thanks!
>>>
>>> So can this change be merge ? or it needs more review?
>>>
>>> BRs,
>>> Lin
>>>> Looks good to me.
>>>> Vyom
>>>>
>>>> ----- Original message -----
>>>> From: "linzang(臧琳)" <linzang at tencent.com>
>>>> To: Vyom Tewari26 <vtewar26 at in.ibm.com>
>>>> Cc: "linzang(臧琳)" <linzang at tencent.com>, nio-dev <nio-dev at openjdk.java.net>
>>>> Subject: [EXTERNAL] Re: RE: RFR: JDK-8239139 testmake fail with warning about strncpy using gcc version 8(Internet mail)
>>>> Date: Tue, Feb 18, 2020 11:35 AM
>>>>
>>>> Dear Vyom,
>>>>          Your change looks good to me.
>>>> And I have updated it to http://cr.openjdk.java.net/~lzang/8239139/webrev02/ .
>>>>
>>>> Thanks,
>>>> Lin
>>>>
>>>>> Hi Lin,
>>>>>
>>>>> thanks for  fixing this issue, i think your changes will have similar warnings with -Wformat-truncation flag. What do you think about below patch ?.
>>>>>
>>>>> Thanks,
>>>>> Vyom
>>>>>
>>>>> --- a/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/libInheritedChannel.c    Mon Feb 17 18:52:50 2020 -0800
>>>>> +++ b/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/libInheritedChannel.c    Tue Feb 18 10:09:50 2020 +0530
>>>>> @@ -232,11 +232,12 @@
>>>>> {
>>>>>       struct sockaddr_un addr;
>>>>>       const char *nameUtf = (*env)->GetStringUTFChars(env, name, NULL);
>>>>> -    int ret = -1;
>>>>> +    int ret = -1, length=sizeof(addr.sun_path);
>>>>>       unlink(nameUtf);
>>>>>       memset(&addr, 0, sizeof(addr));
>>>>>       addr.sun_family = AF_UNIX;
>>>>> -    strncpy(addr.sun_path, nameUtf, strlen(nameUtf));
>>>>> +    strncpy(addr.sun_path, nameUtf, length);
>>>>> +    addr.sun_path[length - 1] = '\0';
>>>>>       ret = bind(sock, (const struct sockaddr*)&addr, sizeof(addr));
>>>>>       if (ret == -1) {
>>>>>           ThrowException(env, "java/io/IOException", "socket bind error");
>>>>>
>>>>> ----- Original message -----
>>>>> From: "linzang(臧琳)" <linzang at tencent.com>
>>>>> Sent by: "nio-dev" <nio-dev-bounces at openjdk.java.net>
>>>>> To: Alan Bateman <Alan.Bateman at oracle.com>, nio-dev <nio-dev at openjdk.java.net>
>>>>> Cc:
>>>>> Subject: [EXTERNAL] Re: Re: RFR: JDK-8239139 testmake fail with warning about strncpy using gcc version 8(Internet mail)
>>>>> Date: Tue, Feb 18, 2020 5:57 AM
>>>>>
>>>>> Thanks Alan.
>>>>>
>>>>> Hi all,
>>>>>      May I get more review about this tiny patch? Thanks!
>>>>>
>>>>> --------------
>>>>> Lin
>>>>>> On 17/02/2020 10:37, linzang(臧琳) wrote:
>>>>>>> From updates in https://bugs.openjdk.java.net/browse/JDK-8239139 ,
>>>>>>> This is related to a test case of recent nio patch.
>>>>>>> so move this thread to nio-dev.
>>>>>>>
>>>>>> Yes, this test was expanded recently to run the launcher with stdin
>>>>>> connected to a Unix domain socket. The len parameter should have been
>>>>>> sizeof(addr.sun_path) but changing this to snprintf looks okay too.
>>>>>>
>>>>>> -Alan.
>>>>>>
>>>>>
>>>>
>> >
>


More information about the nio-dev mailing list