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

cppcheck: post-depinst hook failed with host cppcheck #117

Open
lzaoral opened this issue Aug 28, 2023 · 1 comment
Open

cppcheck: post-depinst hook failed with host cppcheck #117

lzaoral opened this issue Aug 28, 2023 · 1 comment
Labels

Comments

@lzaoral
Copy link
Member

lzaoral commented Aug 28, 2023

  1. Prepare a CentOS Stream 8 host.
  2. Execute csmock -t gcc,cppcheck,clang,shellcheck -r fedora-39-aarch64 -o /tmp/tmpodhysnjl/libssh2-1.10.0-7.fc38.tar.xz --use-host-cppcheck --gcc-analyze /tmp/tmpodhysnjl/libssh2-1.10.0-7.fc38.src.rpm'
  3. The scan will fail with the following error:
>>> 2023-08-27 12:56:07	"tar -cP '/usr/share/csmock/scripts' '/usr/bin/cswrap' '/usr/lib64/cswrap' '/usr/bin/csclng' '/usr/lib64/csclng' '/usr/bin/csclng++' '/usr/bin/cscppc' '/usr/lib64/cscppc' '/usr/share/cscppc' '/usr/bin/cppcheck' '/usr/share/Cppcheck' '/usr/bin/csgcca' '/usr/lib64/csgcca' '/tmp/csmock78iz0380/libssh2-1.10.0-7.fc38.src.rpm' | '/usr/bin/mock' '-r' 'fedora-39-aarch64' '--plugin-option=tmpfs:keep_mounted=True' '--config-opts=print_main_output=True' '--quiet' '--shell' 'tar -xC/'"
tar: Removing leading `/' from member names

scan.ini: analyzer-version-clang = 16.0.6
!!! 2023-08-27 12:56:08	error: post-depinst hook failed

>>> 2023-08-27 12:56:08	"/usr/bin/mock" "-r" "fedora-39-aarch64" "--plugin-option=tmpfs:keep_mounted=True" "--config-opts=print_main_output=True" "--quiet" "--clean"

scan.ini: time-finished = 2023-08-27 12:56:10
scan.ini: exit-code = 127
<<< 2023-08-27 12:56:10	csmock exit code: 127

Wrote: /tmp/tmpodhysnjl/libssh2-1.10.0-7.fc38.tar.xz

Note that the scan succeeds if you omit the --use-host-cppcheck option.

@lzaoral lzaoral added the bug label Aug 28, 2023
@lzaoral lzaoral changed the title cppcheck: post-depinst hook failed cppcheck: post-depinst hook failed with host cppcheck Aug 28, 2023
@kdudka
Copy link
Member

kdudka commented Aug 28, 2023

I guess the cause is that --use-host-cppcheck assumes that cppcheck installed on the host is linked statically, which is usually not the case on a default Fedora installation. We should improve multiple things:

  1. document the assumption
  2. make store_cppcheck_version_hook() in the cppcheck plug-in print an error message on failure
  3. csmock should tell the user which post-depinst hook actually failed

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

No branches or pull requests

2 participants