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

returncode for rpminspect #39

Closed
morucci opened this issue Sep 12, 2019 · 4 comments
Closed

returncode for rpminspect #39

morucci opened this issue Sep 12, 2019 · 4 comments
Assignees

Comments

@morucci
Copy link
Contributor

morucci commented Sep 12, 2019

Hi,

Is there a way to tell rpminspect to return a specific code in case of BAD status for at least one check ? From my tests rpminspect returns only 0 or 1 (when the package is not found for instance).

I want to use rpminspect in a CI job and I want to make the job fail when at least one check is marked as BAD. Checking the return code of rpminspect could be an easier check than going over the json results file to detect BAD status.

Maybe I missed an option.
Thanks

Fabien

@dcantrell
Copy link
Collaborator

This sounds like a bug. Can you paste the output from rpminspect?

@dcantrell dcantrell self-assigned this Sep 12, 2019
@morucci
Copy link
Contributor Author

morucci commented Sep 12, 2019

Hi sure,

Here it is:

➜  python-gear git:(master) ✗ rpminspect python-gear-0.14.0-6.fc32.src.rpm
license:
--------
1) Invalid License Tag in python-gear-0.14.0-6.fc32.noarch: ASL 2.0 
Result: BAD
Waiver Authorization: Not Waivable

Suggested Remedy: The License tag must contain an approved license string as defined by the distribution (e.g., GPLv2+).

man-pages:
----------
Result: OK

xml-files:
----------
Result: OK

elf-object-properties:
----------------------
Result: OK

dist-tag:
---------
Result: OK

spec-file-name:
---------------
Result: OK

java-bytecode:
--------------
Result: OK
➜  python-gear git:(master) ✗ echo $?
0

@dcantrell
Copy link
Collaborator

Yep, that's a bug. It's in main() in rpminspect.c. The success/failure of the run of the inspections is captured, but main() was always returning EXIT_SUCCESS. Ooops. :)

dcantrell added a commit that referenced this issue Sep 12, 2019
The loop over the inspections was picking up the success or failure of
the rpminspect run, but main() was always returning EXIT_SUCCESS.  This
was leftover from when I was originally stubbing out the program and
never got around to making this be 'return ret;'
@dcantrell
Copy link
Collaborator

Fixed in master, thanks for the report!

jeremycline pushed a commit to jeremycline/rpminspect that referenced this issue Jul 13, 2020
The loop over the inspections was picking up the success or failure of
the rpminspect run, but main() was always returning EXIT_SUCCESS.  This
was leftover from when I was originally stubbing out the program and
never got around to making this be 'return ret;'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants