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

Fix dbus service algorithm fallback #191

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ylxdzsw
Copy link

@ylxdzsw ylxdzsw commented Feb 1, 2025

The current error matching is incorrect, as the actual error type returned when algorithm unsupported is DBus(Service(ZBus(MethodError(OwnedErrorName("org.freedesktop.DBus.Error.NotSupported"), Some(""), Msg { .. }))))

It is wrapped in the ServiceError type. Refer to this line: https://github.com/bilelmoussaoui/oo7/blob/main/client/src/dbus/api/service.rs#L101

P.S. the two error variant names have inconsistent capitalization: ServiceError::ZBus vs Error::Zbus. They actually helped me debugging this.

The current error matching is wrong, as the actual error type returned when algorithm unsupported is "DBus(Service(ZBus(MethodError(OwnedErrorName("org.freedesktop.DBus.Error.NotSupported"), Some(""), Msg { .. }))))"
@@ -51,7 +51,7 @@ impl<'a> Service<'a> {
pub async fn new() -> Result<Service<'a>, Error> {
let service = match Self::encrypted().await {
Ok(service) => Ok(service),
Err(Error::Zbus(zbus::Error::MethodError(_, _, _))) => Self::plain().await,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it would be more safe to have both match branches.

Copy link
Author

Choose a reason for hiding this comment

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

I'm fine with keeping both. Do you want me to change it in this pull request?

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