After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 784020 - GKeyFile – Add array length annotations to to_data(), get_keys() and get_groups()
GKeyFile – Add array length annotations to to_data(), get_keys() and get_grou...
Status: RESOLVED WONTFIX
Product: glib
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2017-06-21 07:03 UTC by Sebastian Dröge (slomo)
Modified: 2017-08-14 12:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GKeyFile – Add array length annotations to to_data(), get_keys() and get_groups() (1.93 KB, patch)
2017-06-21 07:03 UTC, Sebastian Dröge (slomo)
committed Details | Review

Description Sebastian Dröge (slomo) 2017-06-21 07:03:45 UTC
See summary
Comment 1 Sebastian Dröge (slomo) 2017-06-21 07:03:50 UTC
Created attachment 354137 [details] [review]
GKeyFile – Add array length annotations to to_data(), get_keys() and get_groups()
Comment 2 Philip Withnall 2017-06-21 10:19:33 UTC
Review of attachment 354137 [details] [review]:

++
Comment 3 Sebastian Dröge (slomo) 2017-06-21 10:48:26 UTC
Attachment 354137 [details] pushed as fd329f4 - GKeyFile – Add array length annotations to to_data(), get_keys() and get_groups()
Comment 4 Emmanuele Bassi (:ebassi) 2017-07-21 14:32:55 UTC
Turns out that this change breaks the introspection ABI, and led to a change in GNOME Shell to cope with it, which means it may have broken every single introspection-based language.

Ideally, all these functions should *not* have a length out argument: the array they return are all NULL-terminated.

I'm going to revert the commit in master, and we're going to figure out what to do.
Comment 5 Sebastian Dröge (slomo) 2017-07-24 07:05:39 UTC
That basically means that we can never fix any annotations that are wrong but not completely broken, most of which probably happened because they were just missed. With real API this won't happen, but annotations can easily be forgotten.

For the Rust bindings we will just have configuration now to override the annotations at the code generator level, but it's a bit suboptimal if every binding has to do that. Especially for bindings generated at runtime like GJS and Python, which also have the disadvantage that new typelibs will be updated without review as compared statically generated bindings where someone actually goes over the changes between versions (or at least one would hope so...).

Also generally this means that annotations can never be changed/improved unless they were just plain broken. As you can never know what considers of an API/ABI change for any of the bindings out there.


What would you suggest for solving this? Adding version/epoch numbers to annotations that are independent of the library version, and bindings/applications would select which they want to use?
Comment 6 Colin Walters 2017-07-25 14:19:07 UTC
Yeah, it's unfortunate.  I don't think there's one single solution; sometimes adding a new C API could make sense.  In others, papering it over in the bindings.

It hurts my head to think about a version/epoch scheme.

In this case I think my vote would be that we just live with the API.
Comment 7 Sebastian Dröge (slomo) 2017-07-31 09:55:33 UTC
Fine with me, it's just annoying :) Maybe GI should've been opt-in for every single piece of API instead of just generating everything, possibly wrongly. Too late now
Comment 8 Philip Withnall 2017-07-31 10:38:20 UTC
Have we actually committed to API stability for any GI bindings?
Comment 9 Emmanuele Bassi (:ebassi) 2017-07-31 11:33:04 UTC
Pretty much, yes: it's far too late to break stuff, these days.
Comment 10 Philip Withnall 2017-08-14 12:09:24 UTC
I guess the fix here then is going to be to paper over the damage in each language’s bindings, depending on what API guarantees they provide to their users. :-(