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 720539 - gdbus-codegen: Fix crasher in goa-using apps
gdbus-codegen: Fix crasher in goa-using apps
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gdbus
unspecified
Other All
: Normal normal
: ---
Assigned To: David Zeuthen (not reading bugmail)
gtkdev
Depends on:
Blocks:
 
 
Reported: 2013-12-16 16:24 UTC by Bastien Nocera
Modified: 2013-12-18 09:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gdbus-codegen: Fix crasher in goa-using apps (1.59 KB, patch)
2013-12-16 16:24 UTC, Bastien Nocera
needs-work Details | Review
gdbus-codegen: Fix crasher in goa-using apps (1.70 KB, patch)
2013-12-17 09:13 UTC, Bastien Nocera
needs-work Details | Review
gdbus-codegen: Fix crasher in goa-using apps (1.66 KB, patch)
2013-12-17 18:15 UTC, Bastien Nocera
accepted-commit_now Details | Review
gdbus-codegen: Fix crasher in goa-using apps (1.87 KB, patch)
2013-12-17 18:26 UTC, Bastien Nocera
committed Details | Review

Description Bastien Nocera 2013-12-16 16:24:42 UTC
This fixes eds and the goa volume monitor crashing on my machine when
launching a goa-daemon with Pocket support added.
Comment 1 Bastien Nocera 2013-12-16 16:24:51 UTC
Created attachment 264301 [details] [review]
gdbus-codegen: Fix crasher in goa-using apps

When replacing a version of goa-daemon (from gnome-online-accounts)
by a newer version with some added properties, evolution-data-server
and the gvfs-goa volume monitor might crash as the extended interface
doesn't match the old one.

Work-around this by returning earlier from the _notify() implementation,
rather than accessing invalid memory.
Comment 2 Bastien Nocera 2013-12-16 16:29:14 UTC
The pocket patch is here:
https://bugzilla.gnome.org/show_bug.cgi?id=704564

1) Compile in jhbuild
2) jhbuild shell
3) ./goa-daemon --replace

gnome-control-center's online accounts panel, gvfs's owncloud support and e-d-s would crash when run with older (3.10) goa libraries against the newer daemon because of the added "ReadLater" property.
Comment 3 David Zeuthen (not reading bugmail) 2013-12-16 18:55:32 UTC
Review of attachment 264301 [details] [review]:

::: gio/gdbus-2.0/codegen/codegen.py
@@ +2771,3 @@
+                     '  _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);\n'
+                     '  g_return_if_fail (info != NULL);\n'
+                     '  g_object_notify (G_OBJECT (object), info->hyphen_name);\n'

Hmm, we definitely want to support "old generated code talking to new daemon" ... because you might include the code in the binary - or statically link it.

This patch will cause spew to stderr which I think is wrong.

I actually thought we had test-cases for stuff like this? If not, someone should probably write those.
Comment 4 David Zeuthen (not reading bugmail) 2013-12-16 18:56:53 UTC
> because of the added "ReadLater" property.

FWIW, that analysis is wrong. The crash is caused because you've added a new _interface_, not a new property.
Comment 5 Bastien Nocera 2013-12-17 09:13:09 UTC
Created attachment 264396 [details] [review]
gdbus-codegen: Fix crasher in goa-using apps

When replacing a version of goa-daemon (from gnome-online-accounts)
by a newer version with some added interfaces, evolution-data-server
and the gvfs-goa volume monitor might crash as there's no interface
definition for this new interface.

Work-around this by returning earlier from the _notify() implementation,
rather than accessing invalid memory.
Comment 6 David Zeuthen (not reading bugmail) 2013-12-17 18:09:09 UTC
Review of attachment 264396 [details] [review]:

::: gio/gdbus-2.0/codegen/codegen.py
@@ +2773,3 @@
+                     '  if (info == NULL);\n'
+                     '    return;\n'
+                     '  g_object_notify (G_OBJECT (object), info->hyphen_name);\n'

Unreachable code and probably not what we want! I'd drop the return and use "info != NULL" instead.
Comment 7 Bastien Nocera 2013-12-17 18:15:01 UTC
Created attachment 264426 [details] [review]
gdbus-codegen: Fix crasher in goa-using apps

When replacing a version of goa-daemon (from gnome-online-accounts)
by a newer version with some added interfaces, evolution-data-server
and the gvfs-goa volume monitor might crash as there's no interface
definition for this new interface.

Work-around this by returning earlier from the _notify() implementation,
rather than accessing invalid memory.
Comment 8 David Zeuthen (not reading bugmail) 2013-12-17 18:24:04 UTC
Review of attachment 264426 [details] [review]:

Looks good with one minor nit. Just commit it.

::: gio/gdbus-2.0/codegen/codegen.py
@@ +2770,3 @@
                      '{\n'
+                     '  _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);\n'
+                     '  /* Old generated code talking to new daemon */\n'

Minor nit: suggest to be a bit more precise here, e.g.

 /* info can be NULL if the other end is using a D-Bus interface we don't know
  * anything about, for example old generated code in this process talking to
  * newer generated code in the other process.
  */
Comment 9 Bastien Nocera 2013-12-17 18:26:56 UTC
Created attachment 264427 [details] [review]
gdbus-codegen: Fix crasher in goa-using apps

When replacing a version of goa-daemon (from gnome-online-accounts)
by a newer version with some added interfaces, evolution-data-server
and the gvfs-goa volume monitor might crash as there's no interface
definition for this new interface.

Work-around this by returning earlier from the _notify() implementation,
rather than accessing invalid memory.
Comment 10 David Zeuthen (not reading bugmail) 2013-12-17 18:28:47 UTC
Review of attachment 264427 [details] [review]:

LGTM, thanks!
Comment 11 Bastien Nocera 2013-12-18 09:54:50 UTC
Pushed to glib-2-36, glib-2-38 and master.

Attachment 264427 [details] pushed as c300079 - gdbus-codegen: Fix crasher in goa-using apps