Closed kloczek closed 1 year ago
Can you try getting the latest changes? The warning (turned errors) shown above are already fixed.
Just tested with all commits added after last release and build still fails
Looks like a different error now. Is that when building packages (make rpm)? What gcc version are you using and can you show the command line you used above to build?
I'm usimg gcc 13.x from fedora rawhide.
Can you show the exact command you are using when encountering the above? The log seems to indicate you are using the -j switch. If so, please remove that switch and try building again.
I'm able to reproduce the error above on Fedora Rawhide when specifying -j8 but it does not reproduce without it. It looks like there is incorrect sequencing when building with multiple concurrent jobs.
Fixed in #164
With that PR I was able to finish build however test suite fails on missing .NET. What is it? š¤
+ /usr/bin/make -O -j48 V=1 VERBOSE=1 test CC=/usr/bin/gcc CXX=/usr/bin/g++
rm -rf obj
rm -rf bin
rm -rf /home/tkloczko/rpmbuild/BUILD/ProcDump-for-Linux-1.4.1/pkgbuild
mkdir -p obj
mkdir -p bin
./tests/integration/run.sh
Please install .NET before running this script!
make: *** [Makefile:85: test] Error 1
On building 1.4.1 + master commits I see build failing
/usr/bin/gcc -o bin/procdump obj/CoreDumpWriter.o obj/DotnetHelpers.o obj/Events.o obj/GenHelpers.o obj/Handle.o obj/Logging.o obj/Monitor.o obj/ProcDumpConfiguration.o obj/Procdump.o obj/Process.o obj/ProfilerHelpers.o obj/ProcDumpProfiler.o -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -Os -I ./include -pthread -std=gnu99 -fstack-protector-all -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -O2 -fanalyzer -Werror
In function 'cleanup_fd',
inlined from 'ExtractProfiler' at src/ProfilerHelpers.c:26:22:
./include/GenHelpers.h:43:8: error: leak of file descriptor 'creat ("/usr/local/bin/procdumpprofiler.so", 452)' [CWE-775] [-Werror=analyzer-fd-leak]
43 | if (*val)
| ^
'ExtractProfiler': events 1-5
|
|src/ProfilerHelpers.c:31:14:
| 26 | auto_free_fd int destfd = -1;
| | ~
| | |
| | (5) inlined call to 'cleanup_fd' from 'ExtractProfiler'
|......
| 31 | destfd = creat(PROCDUMP_DIR "/" PROFILER_FILE_NAME, S_IRWXU|S_IROTH);
| | ^
| | |
| | (1) opened here
| 32 | if (destfd < 0)
| | ~
| | |
| | (2) assuming 'creat ("/usr/local/bin/procdumpprofiler.so", 452)' is a valid file descriptor (>= 0)
| | (3) following 'false' branch...
|......
| 37 | size_t written = 0;
| | ~
| | |
| | (4) ...to here
|
+--> 'cleanup_fd': event 6
|
|./include/GenHelpers.h:43:8:
| 43 | if (*val)
| | ^
| | |
| | (6) 'creat ("/usr/local/bin/procdumpprofiler.so", 452)' leaks here; was opened at (1)
|
src/DotnetHelpers.c: In function 'IsCoreClrProcess':
src/DotnetHelpers.c:51:24: error: use of NULL where non-null expected [CWE-476] [-Werror=analyzer-null-argument]
51 | if(strncmp(ptr, tmpFolder, strlen(tmpFolder)) == 0)
| ^
'LoadProfiler': events 1-3
|
|src/ProfilerHelpers.c:62:5:
| 62 | int LoadProfiler(pid_t pid, char* filter, char* fullDumpPath)
| | ^
| | |
| | (1) entry to 'LoadProfiler'
|......
| 70 | auto_free char* socketName = NULL;
| | ~
| | |
| | (2) 'socketName' is NULL
|......
| 76 | if(!IsCoreClrProcess(pid, &socketName))
| | ~
| | |
| | (3) calling 'IsCoreClrProcess' from 'LoadProfiler'
|
+--> 'IsCoreClrProcess': events 4-5
|
|src/DotnetHelpers.c:25:6:
| 25 | bool IsCoreClrProcess(pid_t pid, char** socketName)
| | ^
| | |
| | (4) entry to 'IsCoreClrProcess'
|......
| 35 | tmpFolder = GetSocketPath("dotnet-diagnostic-", pid, 0);
| | ~
| | |
| | (5) calling 'GetSocketPath' from 'IsCoreClrProcess'
|
+--> 'GetSocketPath': events 6-9
|
|src/GenHelpers.c:366:7:
| 366 | char* GetSocketPath(char* prefix, pid_t pid, pid_t targetPid)
| | ^
| | |
| | (6) entry to 'GetSocketPath'
|......
| 375 | if(targetPid)
| | ~
| | |
| | (7) following 'false' branch (when 'targetPid_15(D) == 0')...
|......
| 388 | int len = snprintf(NULL, 0, "/tmp/%s%d", prefix, pid);
| | ~
| | |
| | (8) ...to here
| 389 | t = malloc(len+1);
| 390 | if(t==NULL)
| | ~
| | |
| | (9) following 'true' branch (when 't_23' is NULL)...
|
'GetSocketPath': event 10
|
|lto1:
| (10): ...to here
|
<------+
|
'IsCoreClrProcess': events 11-14
|
|src/DotnetHelpers.c:35:17:
| 35 | tmpFolder = GetSocketPath("dotnet-diagnostic-", pid, 0);
| | ^
| | |
| | (11) returning to 'IsCoreClrProcess' from 'GetSocketPath'
|......
| 42 | if(procFile != NULL)
| | ~
| | |
| | (12) following 'true' branch...
| 43 | {
| 44 | if(fgets(lineBuf, sizeof(lineBuf), procFile) != NULL)
| | ~ ~
| | | |
| | | (14) following 'true' branch...
| | (13) ...to here
|
'IsCoreClrProcess': event 15
|
|lto1:
| (15): ...to here
|
'IsCoreClrProcess': events 16-18
|
| 46 | while(fgets(lineBuf, 4096, procFile) != NULL)
| | ^
| | |
| | (16) following 'true' branch...
| 47 | {
| 48 | char* ptr = GetPath(lineBuf);
| | ~ ~
| | | |
| | | (18) calling 'GetPath' from 'IsCoreClrProcess'
| | (17) ...to here
|
+--> 'GetPath': events 19-23
|
|src/GenHelpers.c:117:7:
| 117 | char* GetPath(char* lineBuf)
| | ^
| | |
| | (19) entry to 'GetPath'
|......
| 126 | for(int i=0; i<7; i++)
| | ~
| | |
| | (20) following 'true' branch (when 'i_5 != 7')...
| | (22) following 'true' branch (when 'i_5 != 7')...
| 127 | {
| 128 | ptr = strtok(NULL, delim);
| | ~
| | |
| | (21) ...to here
| | (23) ...to here
|
<------+
|
'IsCoreClrProcess': events 24-27
|
|src/DotnetHelpers.c:48:29:
| 48 | char* ptr = GetPath(lineBuf);
| | ^
| | |
| | (24) returning to 'IsCoreClrProcess' from 'GetPath'
| 49 | if(ptr!=NULL)
| | ~
| | |
| | (25) following 'true' branch (when 'ptr_29' is non-NULL)...
| 50 | {
| 51 | if(strncmp(ptr, tmpFolder, strlen(tmpFolder)) == 0)
| | ~ ~
| | | |
| | | (27) argument 1 ('GetSocketPath ("dotnet-diagnostic-", pid_24(D), 0)') NULL where non-null expected
| | (26) ...to here
|
/usr/include/string.h:407:15: note: argument 1 of 'strlen' must be non-null
407 | extern size_t strlen (const char *__s)
| ^
lto1: all warnings being treated as errors
lto-wrapper: fatal error: /usr/bin/gcc returned 1 exit status
With that PR I was able to finish build however test suite fails on missing .NET. What is it? š¤
Some of the integration tests target .NET applications and as such we need to have .NET installed as a prerequisite to running the integration tests. https://learn.microsoft.com/en-us/dotnet/core/install/linux
On building 1.4.1 + master commits I see build failing
These are warnings as a result of turning on static analysis as part of the build process. With each new version of gcc, the static analysis gets better and better and the above are new warnings I haven't encountered before (gcc10). I'll go ahead and add them to the list. In the meantime, you can remove -Werror from the Makefile. You will still see the warnings, but they will not be treated as errors.
Some of the integration tests target .NET applications and as such we need to have .NET installed as a prerequisite to running the integration tests. https://learn.microsoft.com/en-us/dotnet/core/install/linux
Hmm .. why tool which is for monitoring an application and generating crash dumps needs .NET? š is it possible to skip that part? š¤
It doesn't need it. When you install ProcDump on any given system, we detect if you are monitoring a .NET application and if so take a more efficient approach in generating the core dump.
What you are encountering above is as a result of running the integration tests. We want to make sure we have great integration test coverage and as such we make sure we have a .NET application running (which requires .NET to be installed) that we can test against. If you skip running the integration tests, you don't need .NET installed to build the binaries and packages.
OK so how can I disable that part?
BTW did you think about add proper build framework like gnu autotools, cmake or meson? Issuess like missing build dependencies would be not possible to find with use such frameworks.
Running ProcDump (does not require .NET)
sudo procdump ...
Building the ProcDump binaries (does not require .NET)
make
Building the ProcDump packages (does not require .NET)
make deb | rpm
Running integration tests (requires .NET)
make test
There is no way to turn off the .NET tests in the integration test suite since we want to provide a reliable way of making sure changes to ProcDump do not cause any regressions. You can force remove the .NET specific tests locally, but it's not something I would recommend, especially when making changes to the ProcDump code.
Looks like somethinf is wrong and I cannot figure out why build fails