GNOME Bugzilla – Bug 709462
g-ir-compiler: signal "when" attribute is incorrectly built
Last modified: 2018-02-08 12:25:13 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
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.
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 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
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.
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]
-- 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.