-
-
Notifications
You must be signed in to change notification settings - Fork 89
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
"expected the value signature" error somehow ignored with DeserializeDict
, causing confusing "Unexpected non-0 padding byte" error
#856
Comments
Ah, so ignoring the error is part of the derive macro, and is intentional. Which makes a lot of sense... although it doesn't work for this particular error. zbus/zvariant_derive/src/dict.rs Lines 122 to 123 in 87ed52c
Ignoring a parse error won't work properly if it means the bytes have not been consumed, and will be interpreted as something else. Not sure if there's a simple way to address this with how things currently work. |
If this has the wrong type, it causes a parse error due to dbus2/zbus#856. This fixes the status icon for Slack, and probably other applications. Not sure how this field is defined in general, but with Slack it is an `aas`. `gnome-shell-extension-appindicator` doesn't seem to use the `shortcut` field either.
I am not sure if it makes sense actually. Seems like an oversight to me (unless @elmarco happen to remember when he wrote this code?). IMO, it should just error out if deserialization fails. The D-Bus format is very much context-sensitive and deserialization depends completely on the signature provided. |
This is for In this case I fixed the issue by just removing the field, which I wasn't using anyway. pop-os/cosmic-applets@09b2616 (I think I did see that with type type |
Not sure I follow. The outer encoding is a variant but in practice you'll have specific types for each key. The |
I mean it probably does make sense to have the option to ignore dict entries with the wrong type, as the current implementation attempts to do. Maybe not by default though; only with some explicit annotation. |
If this has the wrong type, it causes a parse error due to dbus2/zbus#856. This fixes the status icon for Slack, and probably other applications. Not sure how this field is defined in general, but with Slack it is an `aas`. `gnome-shell-extension-appindicator` doesn't seem to use the `shortcut` field either.
I was getting a weird "Unexpected non-0 padding byte" error. It seems another parse error somehow occurred earlier but was ignored, and it tried to continue parsing, naturally not finding the bytes it expected...
After some debugging, here's a minimal test case:
If this is invoked in d-feet with
{"foo": GLib.Variant("u", 42)}
, it produces:This is a rather confusing error. Is something not aligned properly? But in reality, an error occured earlier in:
zbus/zvariant/src/dbus/de.rs
Lines 313 to 315 in 87ed52c
If this is changed to
Ok(visitor.visit_seq(value_de).unwrap())
, it outputs:So given the code and the message it was trying to parse, that makes sense. But why was that error not propagated properly, and it instead tried to continue parsing? I guess the error isn't being handled properly somewhere up the stack...
The text was updated successfully, but these errors were encountered: