Skip to content

Add missing init/deinit calls#42

Merged
cottsay merged 6 commits into
mainfrom
cottsay/missing-init
May 7, 2026
Merged

Add missing init/deinit calls#42
cottsay merged 6 commits into
mainfrom
cottsay/missing-init

Conversation

@cottsay

@cottsay cottsay commented Apr 8, 2026

Copy link
Copy Markdown
Member

For the Python extension, de-initialization of Assuan as missing. For both the Python extension and the agent executable, initialization and de-initialization of the createrepo_c parser and dumper were missing, leading to a possible segfault when the dumper was lazy initialized by multiple threads simultaneously.

The changes to agent.c involve a small refactor to move the bulk of the code out of main and into a new run function. The main function is still responsible for argument parsing and invocation of the global init/deinit routines, and the actual operations are called from run now. This reduced a lot of the deinit code duplication, especially given that we're now adding two more of them.

Closes #41

For the Python extension, de-initialization of Assuan as missing. For
both the Python extension and the agent executable, initialization and
de-initialization of the createrepo_c parser and dumper were missing,
leading to a possible segfault when the dumper was lazy initialized by
multiple threads simultaneously.
@cottsay cottsay requested a review from j-rivero April 8, 2026 16:18
@cottsay cottsay self-assigned this Apr 8, 2026
@cottsay cottsay added the bug Something isn't working label Apr 8, 2026
@codecov-commenter

codecov-commenter commented Apr 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 28.57143% with 65 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.54%. Comparing base (955efe9) to head (121b3c4).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
src/createrepo-agent/agent.c 13.55% 49 Missing and 2 partials ⚠️
src/python/init.c 35.29% 9 Missing and 2 partials ⚠️
test/integration_main.cpp 62.50% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #42      +/-   ##
==========================================
+ Coverage   48.97%   55.54%   +6.57%     
==========================================
  Files          20       22       +2     
  Lines        2638     2830     +192     
  Branches      538      601      +63     
==========================================
+ Hits         1292     1572     +280     
+ Misses       1039      936     -103     
- Partials      307      322      +15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread src/python/init.c Outdated
Comment thread CMakeLists.txt

@j-rivero j-rivero left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One question test/integration_main.cpp there is an assuan_sock_init(); call, do we need to there the cr_xml_dump_init(); and cr_package_parser_init(); ?

Same for deinit and cleanups in that same file.

Comment thread src/createrepo-agent/agent.c Outdated
@cottsay

cottsay commented Apr 10, 2026

Copy link
Copy Markdown
Member Author

One question test/integration_main.cpp there is an assuan_sock_init(); call, do we need to there the cr_xml_dump_init(); and cr_package_parser_init(); ?

Yes! Good call. Done in c0f4dfa.

@cottsay cottsay force-pushed the cottsay/missing-init branch from c0f4dfa to 838cba8 Compare April 10, 2026 21:01

@j-rivero j-rivero left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Another round and I think we are good to go

Comment thread src/python/init.c Outdated
Comment thread test/integration_main.cpp
Comment thread test/integration_main.cpp Outdated

@j-rivero j-rivero left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good to go. All the big problems are patched as far as I can tell. I left one minor patch.

@cottsay

cottsay commented May 6, 2026

Copy link
Copy Markdown
Member Author

Thanks!

I left one minor patch.

I'm not seeing this, and I don't wanna miss it. Is there a chance that GitHub dropped a comment somewhere?

Comment thread src/python/init.c

@j-rivero j-rivero left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ouch, missed to press the button sorry

Co-authored-by: Jose Luis Rivero <jrivero@honurobotics.com>
@cottsay cottsay merged commit 99a71b1 into main May 7, 2026
3 checks passed
@cottsay cottsay deleted the cottsay/missing-init branch May 7, 2026 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Segmentation fault due to missing initialization

3 participants