Crash due to unhandled ExecutionException with cppcheck installed with snap in ubuntu 20.04
Environment
- Operating System : Ubuntu 20.04 LTS
- IDE Version : CLion 2020.1.2
- Cppcheck executable version : 2.0
- Cppcheck plugin version : 1.4.2
- Exact strings used in cppcheck plugin options:
- cppcheck path: /snap/bin/cppcheck
- cppcheck options: --enable=warning,performance,portability,style --language=c++
Expected behaviour
I expect the found errors being highlighted in clion for this main.cpp:
int main() {
char *p; //(style) unassignedVariable: Variable 'p' is not assigned a value.
*p = 0; // (error) uninitvar: Uninitialized variable: p
}
Just like when I run it from the terminal:
/snap/bin/cppcheck "--template=[{file}:{line}]: ({severity}) {id}: {message}" -I/home/anders/CLionProjects/untitled --enable=warning,performance,portability,style --language=c++ /home/anders/CLionProjects/untitled/main.cpp
Checking /home/anders/CLionProjects/untitled/main.cpp ...
[/home/anders/CLionProjects/untitled/main.cpp:5]: (error) uninitvar: Uninitialized variable: p
[/home/anders/CLionProjects/untitled/main.cpp:4]: (style) unassignedVariable: Variable 'p' is not assigned a value.
Actual behaviour
No inspection warnings/errors are shown, but this is in the event log:
11:22 AM Error: ExecutionException: Cppcheck Error : Exit Code - 1 : /snap/bin/cppcheck "--template=[{file}:{line}]: ({severity}) {id}: {message}" -I/home/anders/CLionProjects/untitled --enable=warning,performance,portability,style --language=c++ /tmp/___main.cpp
Steps to reproduce the behaviour
- Install cppcheck with software center https://snapcraft.io/cppcheck
- Install cppcheck plugin and update to version 1.4.2
- Make a new project.
- Insert code from above in main.
- Watch event log for error message.
Possible workaround
- Install cppcheck with apt-get and use /usr/bin/cppcheck as path
The upcoming version 1.5.1 will report the actual error why the execution failed. Please try that when it is available and provide the error it reports. Thanks.
1.5.1 has been released.
When I try using cppcheck plugin for clion version 1.51 I get the following error message: Cppcheck execution failed. CppcheckError: Exit Code 1 stdout: cppcheck: error: could not find or open any of the paths given. /snap/bin/cppcheck "--template=[{file}:{line}]: ({severity}{inconclusive::inconclusive}) {id}: {message}" -I/home/anders/CLionProjects/MSS400Version --enable=warning,performance,portability,style --language=c++ /tmp/___firmware.cpp It seems this file should have been copied to the /tmp folder before running cppcheck, which does not seem to be the case.
Thanks a lot for the output. The file is copied beforehand. I assume the sandboxing of Snap might prevent this from working. Or mixing the process invocation of CLion with a Snap application. I don't have such a setup and never have used a Snap application but I will try to look into this.
On a side note he Snap application is very out-of-date and should not be used. More details at https://trac.cppcheck.net/ticket/11641.