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

Expect report format scripts to exit with code 0 #1383

Merged
merged 5 commits into from
Dec 23, 2020

Conversation

timopollmeier
Copy link
Member

@timopollmeier timopollmeier commented Dec 21, 2020

What:
To detect more errors, run_report_format_script will handle any non-zero
exit code from the generate script as a failure.

Why:
Being stricter about the return codes makes it easier to detect if errors occur running the report format scripts.

How did you test it:
I modified a report format generate script to return a non-zero exit code and loaded a report in GSA using it.

Checklist:

To detect more errors, run_report_format_script will handle any non-zero
exit code from the generate script as a failure.
@timopollmeier timopollmeier marked this pull request as ready for review December 21, 2020 09:43
* specified what it must be in the past. */
if (ret == -1)
/* Report scripts should return 0 since version 21.04 */
if (ret)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return from system is either -1 or a "wait status". Should you be checking for -1 and using WEXITSTATUS?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed this in e96859a

Instead of relying on `system` to always return 0 on success, the return
code is checked with WIFEXITED if the script terminated normally and
WEXITSTATUS is used to check the exit status.
@mattmundell mattmundell merged commit 5f8b6cf into greenbone:master Dec 23, 2020
@timopollmeier timopollmeier deleted the report-format-exit-status branch October 15, 2021 10:15
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

Successfully merging this pull request may close these issues.

2 participants