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

The plugins libdnf_plugin_new_instance and dnf5_plugin_new_instance API functions discard exceptions #2047

Closed
jrohel opened this issue Feb 9, 2025 · 3 comments · Fixed by #2052
Assignees
Labels
Triaged Someone on the DNF 5 team has read the issue and determined the next steps to take

Comments

@jrohel
Copy link
Contributor

jrohel commented Feb 9, 2025

The libdnf_plugin_new_instance and dnf5_plugin_new_instance functions return a null pointer if the instantiation of the plugin fails. The exception with failure information is discarded. Thus, the caller (libdnf library or dnf5 application) will not know the reason for the failure.

The above functions are linked as "C" functions. It is necessary to provide caller access to the exception.

@jrohel jrohel self-assigned this Feb 9, 2025
@ppisar
Copy link
Contributor

ppisar commented Feb 10, 2025

I confirm the libdnf_plugin_new_instance functions as defined e.g. in libdnf5-plugins/actions/actions.cpp translates the exception to returning nullptr. If we want to return an error message, we need to change the prototype: either add a new argument or change the return type.

@ppisar ppisar added Triaged Someone on the DNF 5 team has read the issue and determined the next steps to take ABI break labels Feb 10, 2025
@ppisar
Copy link
Contributor

ppisar commented Feb 10, 2025

To prevent from the API/ABI break we could add a new function and keep to old one.

@jrohel
Copy link
Contributor Author

jrohel commented Feb 10, 2025

I have extended the dnf5 and libdnf plugin API with a new function to get the last exception. The original functions are unchanged. Plugins that do not implement the new functions can still be used. API and ABI remain compatible.

#2052

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Triaged Someone on the DNF 5 team has read the issue and determined the next steps to take
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants