On Sat, Jan 07, 2023 at 04:53:38PM +0330, Faezeh Bidjarchian wrote: > Hi > > I install the latest version of texinfo (texinfo-7.0.1) and found this > warning: > > gcc -DHAVE_CONFIG_H -I. -I.. -I.. -I../gnulib/lib -I../gnulib/lib > -DLOCALEDIR=\"/usr/local/share/locale\" -g -O2 -MT install-info.o -MD -MP > -MF .deps/install-info.Tpo -c -o install-info.o install-info.c > In file included from /usr/include/string.h:495, > from ../gnulib/lib/string.h:41, > from ../system.h:34, > from install-info.c:18: > In function ‘strncat’, > inlined from ‘split_entry.constprop’ at install-info.c:1605:11: > /usr/include/x86_64-linux-gnu/bits/string_fortified.h:136:10: warning: > ‘__builtin_strncat’ > specified bound depends on the length of the source argument > [-Wstringop-overflow=] > 136 | return __builtin___strncat_chk (__dest, __src, __len, __bos > (__dest)); > | > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > install-info.c: In function ‘split_entry.constprop’: > install-info.c:1604:27: note: length computed here > 1604 | size_t length = strlen (ptr); > | ^~~~~~~~~~~~ > mv -f .deps/install-info.Tpo .deps/install-info.Po > gcc -g -O2 -o ginstall-info install-info.o ../gnulib/lib/libgnu.a > make[3]: Leaving directory '/home/faezeh/texinfo/texinfo-7.0.1/install-info' > Making all in tests
There have long been compiler warnings about the use of strncat in install-info.c but there isn't any indication that the code is actually incorrect. This compiler warning seems to be completely bogus. The real way the code could be improved is to avoid using strcat or strncat altogether. Rewriting the program to reduce the use of strncat could introduce bugs where there weren't any before, for no good reason. However, in the referenced line in this warning, it seems that strcat could be used for exactly the same thing. I'm going to make this change just so we stop getting reports. This has been reported before: https://lists.gnu.org/archive/html/bug-texinfo/2021-06/msg00031.html
