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 754550 - GIR output lacks internal fields, typelib becomes ABI-incompatible
GIR output lacks internal fields, typelib becomes ABI-incompatible
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: GObject Introspection
unspecified
Other Linux
: Normal normal
: 0.42
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2015-09-04 06:55 UTC by Thomas Martitz
Modified: 2018-05-22 15:27 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test source code (177 bytes, text/x-vala)
2015-09-04 06:56 UTC, Thomas Martitz
  Details
GIR file (1.22 KB, application/xml)
2015-09-04 06:58 UTC, Thomas Martitz
  Details
proposed fix (1.42 KB, patch)
2015-09-04 07:22 UTC, Thomas Martitz
none Details | Review

Description Thomas Martitz 2015-09-04 06:55:54 UTC
In the generate C, the internal fields of a class are in the public struct definition (see https://bugzilla.gnome.org/show_bug.cgi?id=697777). However, the GIR output lacks these internal fields entirely.

The result is that the typelib doesn't know about it when accessing members that come after the internal fields, and thus accesses wrong members.

Attached is a test case, generate with valac --vapi=test.vapi --gir=Test-1.0.^Cr test.vala --library test
Comment 1 Thomas Martitz 2015-09-04 06:56:21 UTC
Created attachment 310633 [details]
test source code
Comment 2 Thomas Martitz 2015-09-04 06:58:07 UTC
Created attachment 310634 [details]
GIR file

See how the GIR contains the priv field (for Klass::a), but then follows Klass::c immediately.

Any python script trying to use the public c member will get incorrect results (i.e. the value of b).
Comment 3 Thomas Martitz 2015-09-04 07:22:33 UTC
Created attachment 310635 [details] [review]
proposed fix

Simple fix. Unfortunately there is no way to mark internal fields in .gir as far as I know.
Comment 4 Luca Bruno 2015-10-17 13:44:54 UTC
Yes that's true for fields because it breaks ABI. However modifying that check_accessibility will also make other structures (like classes) public in the gir.

Perhaps that check should be only added to visit_field.
Comment 5 GNOME Infrastructure Team 2018-05-22 15:27:52 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vala/issues/513.