Sysinternals / ProcDump-for-Linux

A Linux version of the ProcDump Sysinternals tool
MIT License
2.95k stars 305 forks source link

1.1: gcc 10 warnings #80

Closed kloczek closed 3 years ago

kloczek commented 4 years ago

With patch https://github.com/microsoft/ProcDump-for-Linux//pull/79.patch

gcc -c -g -o obj/CoreDumpWriter.o src/CoreDumpWriter.c -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -flto=auto -flto-partition=none -I ./include -pthread -std=gnu99
src/CoreDumpWriter.c: In function 'IsCoreClrProcess':
src/CoreDumpWriter.c:124:9: warning: ignoring return value of 'fgets' declared with attribute 'warn_unused_result' [-Wunused-result]
  124 |         fgets(lineBuf, sizeof(lineBuf), procFile); // Skip first line with column headers.
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -o bin/ProcDumpTestApplication obj/ProcDumpTestApplication.o -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -flto=auto -flto-partition=none -I ./include -pthread -std=gnu99
gcc -o bin/procdump obj/Logging.o obj/Events.o obj/ProcDumpConfiguration.o obj/Handle.o obj/Process.o obj/Procdump.o obj/TriggerThreadProcs.o obj/CoreDumpWriter.o -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -flto=auto -flto-partition=none -I ./include -pthread -std=gnu99
In function 'strncpy',
    inlined from 'WriteCoreDumpInternal' at src/CoreDumpWriter.c:494:17:
/usr/include/bits/string_fortified.h:106:10: warning: '__builtin_strncpy' specified bound depends on the length of the source argument [-Wstringop-overflow=]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^
src/CoreDumpWriter.c: In function 'WriteCoreDumpInternal':
src/CoreDumpWriter.c:490:26: note: length computed here
  490 |             lineLength = strlen(lineBuffer);                                // get # of characters read
      |                          ^
In function 'strncpy',
    inlined from 'IsCoreClrProcess.constprop.isra' at src/CoreDumpWriter.c:138:28:
/usr/include/bits/string_fortified.h:106:10: warning: '__builtin_strncpy' specified bound depends on the length of the source argument [-Wstringop-overflow=]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^
src/CoreDumpWriter.c: In function 'IsCoreClrProcess.constprop.isra':
src/CoreDumpWriter.c:138:67: note: length computed here
  138 |                         if(strncpy(*socketName, ptr, sizeof(char)*strlen(ptr)+1)!=NULL)
      |                                                                   ^
jahabibi commented 4 years ago

Given that GCC10 is still in preview we'll hold off until it is released to update procdump.

mgrabovsky commented 3 years ago

GCC 11 has been stable for some time now. Has there been any progress on this?

jahabibi commented 3 years ago

resolved with #104