-
Notifications
You must be signed in to change notification settings - Fork 93
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
Make dnf5 compatible with sdbus-cpp version 2 #1888
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixed compiling against sdbus-cpp v2 in openSUSE Tumblweed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks reasonable to me but the dnf5daemon CI tests fail, I have verified that also locally.
I didn't investigate it further but the error is: [System.Error.ENXIO] Failed to enter a variant (No such device or address)
when sdbus-cpp
< 2.
With sdbus-cpp
>= 2 (I used your build from https://copr.fedorainfracloud.org/coprs/mblaha/dnf5-sdbus-cpp-2/) I am getting some [org.rpm.dnf.v0.rpm.Rpm.TransactionError] rpm transaction failed with code 6
.
cmake/sdbus_cpp.cmake
Outdated
@@ -0,0 +1,11 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could drop this new line.
"org.freedesktop.DBus", "NameOwnerChanged", [this](sdbus::Signal signal) -> void { | ||
SDBUS_INTERFACE_NAME_TYPE{"org.freedesktop.DBus"}, | ||
SDBUS_SIGNAL_NAME_TYPE{"NameOwnerChanged"}, | ||
[this](sdbus::Signal signal) -> void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is in the wrong commit, but it doesn't matter all that much.
Also set SDBUS_CPP_VERSION_2 macro in case sdbus-c++ was found in version 2. This enables conditional compilation according the version of the library found.
- Use InterfaceName type instead of char * for interface names - Use SignalName type instead of char * for signal names - Use ServiceName instead of char * for bus names - Use Error::Name type instead of char * for errors
In version 2 the sdbus::Variant constuctor was made explicit.
In version 2, conversion of sdbus::Variant to the underlying type is explicit.
sdbus-cpp version 2 requires signal handler to have signature (sdbus::Signal signal) -> void, which is also acceptable for version 1.
2f18a16
to
919d5b9
Compare
sdbus-cpp-2 uses different approach to registering methods and signals on the interface.
919d5b9
to
14ee083
Compare
Thanks, the Still working on coredumps with sdbus-cpp version 2. Let me convert this back to draft until the issues are investigated and resolved. |
Exit the event loop and properly join the serving thread.
To address race conditions between the lifetime of the context and callbacks, it is safer to manage them separately. With sdbus-cpp version 2, I observed various failures in dnf5daemon-client, typically following this pattern: - The main thread has already completed its work and is in the process of destructing the Context class. - Meanwhile, the D-Bus event loop thread is still handling messages, and the handler attempts to access the context instance that is currently being destroyed.
45934c7
to
80c6e46
Compare
The new and incompatible version of sdbus-cpp library has been released upstream.
I'd like to upgrade also version in Fedora rawhide, but to not break dnf5
building we fist need to adjust it.
This patch makes dnf5 buildable with both sdbus-cpp versions.