Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash due to unhandled ExecutionException with cppcheck installed with snap in ubuntu 20.04 #39

Open
Birkehoj opened this issue Jun 14, 2020 · 5 comments

Comments

@Birkehoj
Copy link

Birkehoj commented Jun 14, 2020

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
@Birkehoj Birkehoj changed the title Crash due to unhandled ExecutionException with ubuntu 20.04 Crash due to unhandled ExecutionException with cppcheck installed with snap in ubuntu 20.04 Jun 14, 2020
@firewave
Copy link
Collaborator

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.

@firewave
Copy link
Collaborator

1.5.1 has been released.

@Birkehoj
Copy link
Author

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.

@firewave
Copy link
Collaborator

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.

@firewave
Copy link
Collaborator

firewave commented Apr 1, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants