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

Change: Replace CPE xml_split with XML iterator #2142

Merged
merged 5 commits into from
Mar 6, 2024

Conversation

timopollmeier
Copy link
Member

What

When updating the CPEs, the CPE dictionary file is no longer split into separate temporary files. Instead a new XML file iterator added to gvm-libs is used to avoid creating the DOM of the whole file. Also, the buffered insert statements are now also run when a size threshold configurable via a setting is reached.

Why

This removes the dependency on the xml_split script, avoids problems with the temp split XML files being left behind in case of crashes and gives more control over the memory usage of the CPEs update.

References

requires greenbone/gvm-libs#808
GEA-488

When updating the CPEs, the CPE dictionary file is no longer split
into separate temporary files. Instead a new XML file iterator added to
gvm-libs is used to avoid creating the DOM of the whole file.
Also, the buffered insert statements are now also run when a size
threshold configurable via a setting is reached.

This removes the dependency on the xml_split script, avoids problems
with the temp split XML files being left behind in case of crashes and
gives more control over the memory usage of the CPEs update.
@timopollmeier timopollmeier requested a review from a team as a code owner March 1, 2024 10:20
Copy link

github-actions bot commented Mar 1, 2024

Conventional Commits Report

Type Number
Removed 1
Changed 1

🚀 Conventional commits found.

src/manage_sql_secinfo.c Show resolved Hide resolved
src/manage_sql_secinfo.c Show resolved Hide resolved
src/manage_sql_secinfo.c Show resolved Hide resolved
src/manage_sql_secinfo.c Show resolved Hide resolved
src/manage_sql_secinfo.c Show resolved Hide resolved
src/manage_sql.c Outdated Show resolved Hide resolved
The error handling is improved by freeing the iterator on errors,
consistently jumping to the failure handling and handling cases
where (re-)initalizing the parser context fails.
Also the limit for the threshold is now always applied.
a-h-abdelsalam
a-h-abdelsalam previously approved these changes Mar 5, 2024
Copy link
Member

@cfi-gb cfi-gb left a comment

Choose a reason for hiding this comment

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

To me it looks like there are some places where xml_split could be removed:

  • INSTALL.md
  • src/CMakeLists.txt
  • .docker/prod.Dockerfile (xml-twig-tools)

or am i wrong?

@timopollmeier timopollmeier marked this pull request as draft March 6, 2024 09:50
This optional dependency is no longer needed with the new XML file
iterator.
@timopollmeier timopollmeier marked this pull request as ready for review March 6, 2024 09:54
@timopollmeier timopollmeier requested a review from a team as a code owner March 6, 2024 09:54
@timopollmeier
Copy link
Member Author

To me it looks like there are some places where xml_split could be removed:

* INSTALL.md

* src/CMakeLists.txt

* .docker/prod.Dockerfile (`xml-twig-tools`)

or am i wrong?

No, you're right. I've removed these references now.

@timopollmeier timopollmeier merged commit 8891f74 into main Mar 6, 2024
9 checks passed
@timopollmeier timopollmeier deleted the improve-scap-update branch March 6, 2024 10:34
@cfi-gb
Copy link
Member

cfi-gb commented Mar 7, 2024

Only for references, this could possibly also solves problems from the past like e.g.:

@cfi-gb
Copy link
Member

cfi-gb commented Nov 13, 2024

It seems two additional places have been missed (A comment in the Dockerfile and the community docs) which have been adjusted now accordingly:

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.

3 participants