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 684319 - Introspected version of g_resources_(un)register needs a trailing underscore
Introspected version of g_resources_(un)register needs a trailing underscore
Status: RESOLVED OBSOLETE
Product: gobject-introspection
Classification: Platform
Component: g-ir-scanner
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks: 660923 675295
 
 
Reported: 2012-09-18 19:09 UTC by Conscious User
Modified: 2017-05-04 21:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
scanner: Warn for methods which don't have the expected prefix (2.18 KB, patch)
2012-10-26 16:11 UTC, Colin Walters
reviewed Details | Review
scanner: Add "Alias" tag for fixing method names (6.79 KB, patch)
2012-10-26 18:31 UTC, Colin Walters
needs-work Details | Review
GResources: Make use of Alias tag for g_resources_register/unregister (1.18 KB, patch)
2012-10-26 18:50 UTC, Colin Walters
needs-work Details | Review

Description Conscious User 2012-09-18 19:09:10 UTC
When using PyGObject, I can't call Gio.Resource.register and need to call Gio.Resource._register instead. Same goes for unregister.
Comment 1 Colin Walters 2012-10-26 15:27:35 UTC
Ok, this is a very nasty bug.  Basically, for API like this:

void regress_test_objstuffstuffstuff_other_prefix2 (RegressTestObj *obj);

We end up with:

 <method name="tuffstuffstuff_other_prefix2"
              c:identifier="regress_test_objstuffstuffstuff_other_prefix2">

Because we simply strip off the "expected prefix" + 1, where the assumed the +1 would be the underscore.  We probably should have made this a fatal error...but far too late now, this bit of code has been around a long time =(

Option #1: Check whether there's an underscore where we expect.  If not, we can generate *two* versions of the method.  One which is a legacy backwards compat version, and one where we just ignore the intervening junk.

Option #2 is to warn, and not do anything in g-i.  Then libraries would have to be fixed.  For GLib, this would mean we'd need new symbols g_resource_register()/g_resource_unregister().

I'm not sure which is better.  I think we should add a warning regardless.
Comment 2 Colin Walters 2012-10-26 16:11:12 UTC
Created attachment 227371 [details] [review]
scanner: Warn for methods which don't have the expected prefix

For API that "looks like" a method, previously, we simply stripped
off the "expected prefix".  The problem comes for things like

void g_resources_register (GResource *resource);

We expect this to be

void g_resource_register (GResource *resource);

At present, the "s" gets stripped, and the _ gets into the name.  This
is obviously very suboptimal.  However, there's a large backwards
compatibility concern here - we can't just rename the methods at this
point.  The behavior has existed for a long time.

Thus for now, simply warn.  Unfortunately we can't add a test to
tests/warn because it doesn't support custom objects.
Comment 3 Colin Walters 2012-10-26 18:31:28 UTC
Created attachment 227381 [details] [review]
scanner: Add "Alias" tag for fixing method names

This allows users to fix method names that are parsed badly.
Comment 4 Colin Walters 2012-10-26 18:50:12 UTC
Created attachment 227382 [details] [review]
GResources: Make use of Alias tag for g_resources_register/unregister

Due to historical bogosity in g-ir-scanner, these method names
end up as "_register" and "_unregister", i.e. with a leading
underscore.

This is lame, but we need to keep them.  Use a new g-i feature to also
expose them with a different name.
Comment 5 Matthias Clasen 2012-10-26 23:37:20 UTC
Does gtk-doc know to ignore these new tags ?
Comment 6 Colin Walters 2012-10-27 15:31:48 UTC
(In reply to comment #5)
> Does gtk-doc know to ignore these new tags ?

Probably not...this is https://bugzilla.gnome.org/show_bug.cgi?id=676133
Comment 7 Jasper St. Pierre (not reading bugmail) 2014-01-03 00:05:39 UTC
I'd prefer if we introduced g_resource_register / g_resource_unregister and deprecated the old symbols.
Comment 8 Jasper St. Pierre (not reading bugmail) 2014-01-03 00:06:51 UTC
Review of attachment 227371 [details] [review]:

Looks good
Comment 9 Jasper St. Pierre (not reading bugmail) 2014-01-03 00:07:10 UTC
Review of attachment 227381 [details] [review]:

Going to need a rebase.
Comment 10 Jasper St. Pierre (not reading bugmail) 2014-01-03 00:07:16 UTC
Review of attachment 227382 [details] [review]:

Going to need a rebase.
Comment 11 André Klapper 2015-02-07 17:18:27 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]
Comment 12 Dieter Verfaillie 2015-04-19 07:33:48 UTC
Review of attachment 227371 [details] [review]:

Is this patch still relevant as https://git.gnome.org/browse/gobject-introspection/commit/?id=6432c9213bff425d7d0f2be39df59337588caff3 seems to have introduced a different solution?
Comment 13 Dieter Verfaillie 2015-04-19 07:34:07 UTC
Review of attachment 227382 [details] [review]:

Is this patch still relevant as https://git.gnome.org/browse/gobject-introspection/commit/?id=6432c9213bff425d7d0f2be39df59337588caff3 seems to have introduced a different solution?
Comment 14 Emmanuele Bassi (:ebassi) 2017-05-04 21:43:29 UTC
Two years later and no comment → obsolete.