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 679473 - Don't generate invalid property names
Don't generate invalid property names
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gdbus
unspecified
Other Linux
: Normal normal
: ---
Assigned To: David Zeuthen (not reading bugmail)
gtkdev
Depends on:
Blocks:
 
 
Reported: 2012-07-05 21:24 UTC by David Zeuthen (not reading bugmail)
Modified: 2012-07-06 13:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Change in udisks generated code (5.84 KB, patch)
2012-07-06 13:32 UTC, David Zeuthen (not reading bugmail)
none Details | Review

Description David Zeuthen (not reading bugmail) 2012-07-05 21:24:35 UTC
I have a property with the name "type-" on the UDisksPartitionTable type (it's a GInterface). For some reason g-ir-scanner complains about it even though it is a perfectly valid name [1], see [2] for warnings.

This is the relevant registration code:

  /**
   * UDisksPartitionTable:type-:
   *
   * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UDisks2-PartitionTable.Type">"Type"</link>.
   *
   * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
   */
  g_object_interface_install_property (iface,
    g_param_spec_string ("type-", "Type", "Type", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

[1] : it was chosen by gdbus-codegen(1) as the GObject property name for a D-Bus property with the name "Type"....

[2] :

udisks-generated.c:14056: Warning: UDisks: ignoring unrecognized GTK-Doc comment block, identifier not found:
   * UDisksPartitionTable:type-:
     ^
udisks-generated.c:15628: Warning: UDisks: ignoring unrecognized GTK-Doc comment block, identifier not found:
   * UDisksPartition:type-:
     ^
g-ir-scanner: compile: gcc -Wall -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I.. -I.. -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -c -o /ostbuild/source/udisks/_build/udisks/tmp-introspect8jJo0X/UDisks-2.0.o /ostbuild/source/udisks/_build/udisks/tmp-introspect8jJo0X/UDisks-2.0.c
Comment 1 David Zeuthen (not reading bugmail) 2012-07-05 21:42:39 UTC
Looking more closely at this, the docs for g_param_spec_internal() state

 A property name consists of segments consisting of ASCII letters and digits,
 separated by either the '-' or '_' character. The first character of a property
 name must be a letter. Names which violate these rules lead to undefined
 behaviour.

which suggest that the property name "type-" actually is invalid... so we have two options now

 - retroactively allow property names ending in '-'
 - fix gdbus-codegen(1) to not use invalid property names

The latter would perhaps break some generated code (libudisks2 in particular) but I don't think that matters _that_ much since the name was invalid in the first place. So I think we should probably just fix gdbus-codegen(1) instead... thoughts?
Comment 2 David Zeuthen (not reading bugmail) 2012-07-06 13:27:34 UTC
OK, fixed in gdbus-codegen along with a test case, see

 http://git.gnome.org/browse/glib/commit/?id=d72116d8b7c802895be6b02093342fd9e770813d

for details.
Comment 3 David Zeuthen (not reading bugmail) 2012-07-06 13:32:58 UTC
Created attachment 218182 [details] [review]
Change in udisks generated code

This is the change in the generated code for a fairly complex set of D-Bus interfaces - as you can see only the GObject property has changed (the float comparison change is from bug 678333).