Dear Lijian,

Please stop trying to “fix” string_test.c. It’s not worth the community’s time.

Thanks... Dave

From: Lijian Zhang (Arm Technology China) <lijian.zh...@arm.com>
Sent: Saturday, December 15, 2018 4:52 AM
To: Dave Barach (dbarach) <dbar...@cisco.com>; Stephen Hemminger 
<step...@networkplumber.org>
Cc: vpp-dev@lists.fd.io
Subject: RE: [vpp-dev] string test failing

Hi Stephen,
Seems you are using a GCC with version number greater than 8. Right?
Could you let me know the exact version number of GCC on that machine?

Seems it should use clib_strncpy instead of strncpy in test_clib_strncpy, 
otherwise, the warning will be trigger with latest gcc version.

$ git diff
diff --git a/src/plugins/unittest/string_test.c 
b/src/plugins/unittest/string_test.c
index 65b7c62..f231d95 100644
--- a/src/plugins/unittest/string_test.c
+++ b/src/plugins/unittest/string_test.c
@@ -770,7 +770,7 @@ test_clib_strncpy (vlib_main_t * vm, unformat_input_t * 
input)

#if __GNUC__ < 8
   /* GCC 8 flunks this one at compile time... */
-  strncpy (dst, "The price of greatness is responsibility.", 10);
+  clib_strncpy (dst, "The price of greatness is responsibility.", 10);
   if (strcmp_s (dst, clib_strnlen (dst, sizeof (dst)), "The price ",
                &indicator) != EOK)
     return -1;

From: vpp-dev@lists.fd.io<mailto:vpp-dev@lists.fd.io> 
<vpp-dev@lists.fd.io<mailto:vpp-dev@lists.fd.io>> On Behalf Of Dave Barach via 
Lists.Fd.Io
Sent: Saturday, December 15, 2018 4:19 AM
To: Stephen Hemminger 
<step...@networkplumber.org<mailto:step...@networkplumber.org>>
Cc: vpp-dev@lists.fd.io<mailto:vpp-dev@lists.fd.io>
Subject: Re: [vpp-dev] string test failing

Figured. Thanks. I’ll revert the patch.

D.

From: vpp-dev@lists.fd.io<mailto:vpp-dev@lists.fd.io> 
<vpp-dev@lists.fd.io<mailto:vpp-dev@lists.fd.io>> On Behalf Of Stephen Hemminger
Sent: Friday, December 14, 2018 3:06 PM
To: Dave Barach (dbarach) <dbar...@cisco.com<mailto:dbar...@cisco.com>>
Cc: vpp-dev@lists.fd.io<mailto:vpp-dev@lists.fd.io>
Subject: Re: [vpp-dev] string test failing

Yes, reverting that makes build/test succeed.

$ gcc --version
gcc (Debian 8.2.0-9) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


On Fri, Dec 14, 2018 at 12:00 PM Dave Barach (dbarach) 
<dbar...@cisco.com<mailto:dbar...@cisco.com>> wrote:
Please revert https://gerrit.fd.io/r/#/c/16429/ and report results.

-----Original Message-----
From: vpp-dev@lists.fd.io<mailto:vpp-dev@lists.fd.io> 
<vpp-dev@lists.fd.io<mailto:vpp-dev@lists.fd.io>> On Behalf Of Stephen Hemminger
Sent: Friday, December 14, 2018 2:58 PM
To: vpp-dev@lists.fd.io<mailto:vpp-dev@lists.fd.io>
Subject: [vpp-dev] string test failing

String tests now failing on Debian testing.

Compiler is catching error before test!

FAILED: plugins/unittest/CMakeFiles/unittest_plugin.dir/string_test.c.o
ccache /usr/lib/ccache/cc -DHAVE_MEMFD_CREATE -Dunittest_plugin_EXPORTS 
-I/home/shemminger/git/vpp/src -I. -Iinclude 
-I/home/shemminger/git/vpp/src/plugins -Iplugins -march=corei7 
-mtune=corei7-avx -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 -fstack-protector-all 
-fPIC -Werror -fPIC   -Wno-address-of-packed-member -Wall -MD -MT 
plugins/unittest/CMakeFiles/unittest_plugin.dir/string_test.c.o -MF 
plugins/unittest/CMakeFiles/unittest_plugin.dir/string_test.c.o.d -o 
plugins/unittest/CMakeFiles/unittest_plugin.dir/string_test.c.o   -c 
/home/shemminger/git/vpp/src/plugins/unittest/string_test.c
/home/shemminger/git/vpp/src/plugins/unittest/string_test.c: In function 
‘test_clib_strncpy’:
/home/shemminger/git/vpp/src/plugins/unittest/string_test.c:766:3: error: 
‘strncpy’ output truncated copying 10 bytes from a string of length 41 
[-Werror=stringop-truncation]
   strncpy (dst, "The price of greatness is responsibility.", 10);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#11624): https://lists.fd.io/g/vpp-dev/message/11624
Mute This Topic: https://lists.fd.io/mt/28756144/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to