You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm the creator of pydbus, DBus bindings for Python. I've stumbled upon the case of bytestrings - ay - which are commonly used to send non-Unicode data over DBus.
Because of the GDBus's API, apps commonly require these strings to be '\0'-terminated. And that's completely unintuitive for high-level languages, and something that requires the user to read API docs.
I'm thinking about solving the problem automatically, and I see two solutions:
Auto-append and auto-strip the last character of "ay"s; [EDIT: impossible, some APIs use not-terminated strings]
Decree (how?) that GDBus API is wrong, and strings sent over the wire should not be \0-terminated.
[EDIT:] Create a new DBus annotation meaning "All "ay"s in the arguments of this method/signal are \0-terminated bytestrings" - and auto-append/auto-strip \0 if it's present.
Whatever we choose, the solution should be agreed upon by authors of bindings for all languages. That's why I'm here.
Do you have any experience with "ay"-encoded bytestrings?
Relevant discussion: LEW21/pydbus#27 (please reply there, I've opened similar issues in 8 different projects to get attention of bindings authors)
The text was updated successfully, but these errors were encountered:
Note that obus is a pure OCaml implementation so it doesn't suffer from this problem. Values of D-Bus type ay are represented by obus as strings, which in OCaml are just array of bytes that can contain NUL bytes.
I looked at the C API and GDBus a while ago. I don't remember all the details, but requiring NUL-terminated strings for ay values is plain wrong IMO. ay values are supposed to be array of bytes so one shouldn't use NUL-terminated strings to represent them. It seems to me that the GDBus API should be updated to represent ay values as arbitrary array of bytes.
Alternatively, if there is a real need for passing NUL-terminated strings that are not UTF-8 encoded, then maybe it should be considered to add a D-Bus type for these. But that'd be really C-centric.
Hi,
I'm the creator of pydbus, DBus bindings for Python. I've stumbled upon the case of bytestrings - ay - which are commonly used to send non-Unicode data over DBus.
Because of the GDBus's API, apps commonly require these strings to be '\0'-terminated. And that's completely unintuitive for high-level languages, and something that requires the user to read API docs.
I'm thinking about solving the problem automatically, and I see two solutions:
Whatever we choose, the solution should be agreed upon by authors of bindings for all languages. That's why I'm here.
Do you have any experience with "ay"-encoded bytestrings?
Relevant discussion: LEW21/pydbus#27 (please reply there, I've opened similar issues in 8 different projects to get attention of bindings authors)
The text was updated successfully, but these errors were encountered: