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 623810 - Message serialization bug
Message serialization bug
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gdbus
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2010-07-08 07:18 UTC by Peng Huang
Modified: 2010-07-15 16:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add a small program to reproduce this issue (975 bytes, text/plain)
2010-07-15 00:45 UTC, Peng Huang
Details

Description Peng Huang 2010-07-08 07:18:10 UTC
I found g_dbus_method_invocation_return_value (invocation, NULL) will reply a message with signature "()". I think it should be "".
Comment 1 Peng Huang 2010-07-08 08:24:54 UTC
Additional information:
When I get a void reply message from a connection and send it to another connection, g_dbus_connection_send_message return an error. The error message is "Message body is empty but signature in the header field is `()'". Do you have any idea about this problem?
Comment 2 Peng Huang 2010-07-08 08:30:27 UTC
After investigation, I found the problem maybe in g_dbus_message_to_blob. If the body is NULL and signature is not NULL, it will return the error.
Comment 3 David Zeuthen (not reading bugmail) 2010-07-14 15:57:54 UTC
I'm not sure there's a bug here - the way it's supposed to work is like this

 1. If body is NULL then signature must be NULL as well. Similar if
    signature is NULL then body must be NULL.

 2. Otherwise, the signature of the message must equal the GVariant
    type-string of the body except for the starting and ending
    parenthesis.

 3. Specifically g_dbus_message_set_body() updates the signature to
    like asked for in 2.

 4. Note that the body==NULL case is similar to the case where
    the body is an empty GVariant tuple and signature is the empty
    string. The only reason we allow NULL values is performance.

Please reopen if you find a bug with how this works.
Comment 4 Peng Huang 2010-07-15 00:45:41 UTC
Created attachment 165937 [details]
Add a small program to reproduce this issue

In this program, the message body is NULL, and the signature is an empty string. And the message can not be serialized.
Comment 5 Peng Huang 2010-07-15 00:46:21 UTC
The output of this program.
dhcp-172-30-136-58:test penghuang$ ./test
** (process:17029): DEBUG: signature='', body=0x100412200
** (process:17029): DEBUG: signature='', body=0x0
** (process:17029): DEBUG: Message body is empty but signature in the header field is `()'
Comment 6 David Zeuthen (not reading bugmail) 2010-07-15 16:22:34 UTC
I see. So the problem is that we are failing the case where body==NULL but signature is the empty string. I've fixed that with this commit

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

and this makes the test program from comment 4 work as expected. I've also included a test case for this.

Please verify that this fixes the problem you were experiencing. Thanks!