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 709462 - g-ir-compiler: signal "when" attribute is incorrectly built
g-ir-compiler: signal "when" attribute is incorrectly built
Status: RESOLVED OBSOLETE
Product: gobject-introspection
Classification: Platform
Component: libgirepository
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2013-10-05 07:20 UTC by Simon Feltman
Modified: 2018-02-08 12:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Use case insensitive compare for signal "when" attribute (1.15 KB, patch)
2013-10-05 08:45 UTC, Simon Feltman
committed Details | Review
Use lowercase strings for signal "where" attributes consistently (1.91 KB, patch)
2013-10-05 21:23 UTC, Simon Feltman
none Details | Review

Description Simon Feltman 2013-10-05 07:20:04 UTC
The compiler is doing a case sensitive compare with upper case versions of the "when" attributes valid values. GIR files look to be written with lowercase, causing g_signal_info_get_flags to always return G_SIGNAL_CLEANUP for signal flags.

girepository/gdump.c (lowercase):
https://git.gnome.org/browse/gobject-introspection/tree/girepository/gdump.c?h=gnome-3-10#n176

girepository/girwriter.c (uppercase):
https://git.gnome.org/browse/gobject-introspection/tree/girepository/girwriter.c?h=gnome-3-10#n862

giscanner/girscanner.py (lowercase):
https://git.gnome.org/browse/gobject-introspection/tree/giscanner/ast.py?h=gnome-3-10#n350

I'm not sure which of these is "correct" but the resulting .gir files are lowercase, at least for Regress-1.0.gir:
    <glib:signal name="sig-with-obj" when="last">

You can see the failing comparison is here:
girepository/girparser.c:
https://git.gnome.org/browse/gobject-introspection/tree/girepository/girparser.c?h=gnome-3-10#n2301
Comment 1 Simon Feltman 2013-10-05 08:45:22 UTC
Created attachment 256530 [details] [review]
Use case insensitive compare for signal "when" attribute

Update parser to use g_ascii_strcasecmp instead of strcmp. This fixes
incorrect flags being set when the incomming gir is using lowercase values
for the "when" attribute.

Notes:
I'm not sure if g_ascii_strcasecmp is the right thing to use here, but I've 
verified it fixes the problem at least with analizing typelibs with the 
Python bindings. There might also be other cases where this is problematic.
Comment 2 Colin Walters 2013-10-05 13:35:39 UTC
Review of attachment 256530 [details] [review]:

This seems like the safest fix indeed, although I'm not sure what would break if we just lowercased the writer too.
Comment 3 Simon Feltman 2013-10-05 21:01:29 UTC
Comment on attachment 256530 [details] [review]
Use case insensitive compare for signal "when" attribute

Attachment 256530 [details] pushed as f6770c8 - Use case insensitive compare for signal "when" attribute
Comment 4 Simon Feltman 2013-10-05 21:23:28 UTC
Created attachment 256551 [details] [review]
Use lowercase strings for signal "where" attributes consistently

Change parser and writer to use lowercase named values for the "where"
attribute. This gives consistency with the rest of the attributes usage.

Notes:
This is an attempt to make the code base more consistent. I completely lack 
a good understanding of how this stuff fits together and and don't know 
the diff between giwriter and gdump... I can only assume Regress-1.0.gir is 
being created with gdump because it is using lowercase values? In any 
case the committed usage of g_ascii_strcasecmp still seems like it should  
stay just to be on the safe side because we don't know what's in the wild.
Comment 5 André Klapper 2015-02-07 17:14:34 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]
Comment 6 GNOME Infrastructure Team 2018-02-08 12:25:13 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/gobject-introspection/issues/97.