<<this bug="" is="" from="" 2009-09-08="" 12:33:31="" PDT="">>
I hesitate to report this since it seems more likely that somehow I am wrong,
but... I had to make the following changes to allow me to correctly handle
variant maps with nested variant maps, i.e. it seems like this logical
expression (below) is exactly opposite of what it should be. Prior to this
change, I got errors like:
process 10525: arguments to dbus_message_iter_open_container() were incorrect,
assertion "(type == DBUS_TYPE_STRUCT && contained_signature == NULL) || (type
== DBUS_TYPE_DICT_ENTRY && contained_signature == NULL) || (type ==
DBUS_TYPE_VARIANT && contained_signature != NULL) || (type == DBUS_TYPE_ARRAY
&& contained_signature != NULL)" failed in file dbus-message.c line 2360.
and in looking at dbus-message.c from dbus-1.2.14, it seems like my
interpretation is correct. I tested with a std::map<std::string,DBus::Variant>
which had a std::map<std::string,DBus::Variant> as one of its DBusVariant
members.
Darrell
--- dbus-c++/src/message.cpp 2009-09-08 15:20:51.000000000 -0400
+++ dbus-c++-0.5.0/src/message.cpp 2009-09-08 14:38:29.000000000 -0400
@@ -21,9 +21,6 @@
/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
#include <dbus-c++ message.h="">
@@ -350,7 +347,7 @@
(
(DBusMessageIter )&(to._iter),
from.type(),
- from.type() == DBUS_TYPE_VARIANT ? NULL : sig,
+ from.type() == DBUS_TYPE_DICT_ENTRY || from.type() ==
DBUS_TYPE_STRUCT? NULL : sig,
(DBusMessageIter )&(to_container._iter)
);
Generation of this XML code works:
Please provide example code that shows reported problem.
I don't know if this will be enough information or not, but I added the following change to message.cpp (after removing my fix):
--- src/message.cpp.orig 2011-11-28 09:40:57.000000000 -0500
+++ src/message.cpp 2011-11-28 09:42:51.000000000 -0500
@@ -342,6 +342,8 @@
MessageIter to_container (to.msg());
dbus_message_iter_open_container
(
This results in the following output (where the error occurrs):
CASA <2>: im.drawmask('ngc5921.clean.image', 'test.mask')
(0) ==>>> a[{sv}]
(1) ==>>> e[s]
process 67959: arguments to dbus_message_iter_open_container() were incorrect, assertion "(type == DBUS_TYPE_STRUCT && contained_signature == NULL) || (type == DBUS_TYPE_DICT_ENTRY && contained_signature == NULL) || (type == DBUS_TYPE_VARIANT && contained_signature != NULL) || (type == DBUS_TYPE_ARRAY && contained_signature != NULL)" failed in file dbus-message.c line 2393.
This is normally a bug in some application using the D-Bus library.
D-Bus not built with -rdynamic so unable to print a backtrace
Darrell
For the sake of completeness, this is the output with both the fix and the debug output:
CASA <2>: im.drawmask('ngc5921.clean.image', 'test.mask')
(0) ==>>> a[{sv}]
(1) ==>>> e[s]
(2) ==>>> v[i]
(3) ==>>> e[s]
(4) ==>>> v[i]
(5) ==>>> e[s]
(6) ==>>> v[s]
(7) ==>>> a[b]
Darrell
(1) ==>>> e[s] ????
What is this 'e' type?
Please see here dbus-c++ generator documentation:
https://sourceforge.net/apps/mediawiki/dbus-cplusplus/index.php?title=Introspection_Format
I don't know 'e' type. From what I understand DBUS_TYPE_DICT_ENTR is mapped to std::map.
So how did you construct your application? I don't think with XML and dbusxx-xml2cpp, or?
So please show me a minimal code example that compiles without many dependencies which shows this error.
You can find an example at:
http://www.cv.nrao.edu/~dschieb/minimal_dbus-c++_qt.tar.gz
You will need to have Qt4 available. Build as follows:
cd server
qmake server.pro
make
cd ../client
make
Run the server, and then run the client. Without my bug fix, you should see this output from the client:
bash$ ./client
process 15426: arguments to dbus_message_iter_open_container() were incorrect, assertion "(type == DBUS_TYPE_STRUCT && contained_signature == NULL) || (type == DBUS_TYPE_DICT_ENTRY && contained_signature == NULL) || (type == DBUS_TYPE_VARIANT && contained_signature != NULL) || (type == DBUS_TYPE_ARRAY && contained_signature != NULL)" failed in file dbus-message.c line 2393.
This is normally a bug in some application using the D-Bus library.
D-Bus not built with -rdynamic so unable to print a backtrace
Abort trap
bash$
Ok, I looked into your example. Thanks for providing it. I was able to compile and reproduce your error.
I see what you try to do with your variant conversation, but from first look I'm not able to judge if this is a dbus-c++ bug or a bug in your "conversation magic". I tried various "normal" variant examples and had success. Are you using a recent version of dbus-c++ from GIT?
From this unclear situation I've to postpone this ticket. I'm open to discuss this topic on the mailing list. This is much faster and more effective. Please join the list and start discussion.
You're welcome to reopen the ticket if a dbus-c++ bug is clear visible.
OK, thanks for looking. I think the following points are salient: (1) I only use the dbus-c++ interface to construct the dbus messages, (2) the error is signaled by the layer (dbus) that dbus-c++ is intended to wrap, and (3) with the fix, the messages are received properly by QtDbus which has a very robust C++ binding for dbus.
Same behaviour here with this structure (b(oss)):
process 9768: arguments to dbus_message_iter_open_container() were incorrect, assertion "(type == DBUS_TYPE_STRUCT && contained_signature == NULL) || (type == DBUS_TYPE_DICT_ENTRY && contained_signature == NULL) || (type == DBUS_TYPE_VARIANT && contained_signature != NULL) || (type == DBUS_TYPE_ARRAY && contained_signature != NULL)" failed in file ../../dbus/dbus-message.c line 2727.
This is normally a bug in some application using the D-Bus library.
process 9768: dbus message iterator looks uninitialized or corrupted
process 9768: arguments to dbus_message_iter_append_basic() were incorrect, assertion "_dbus_message_iter_append_check (real)" failed in file ../../dbus/dbus-message.c line 2521.
This is normally a bug in some application using the D-Bus library.
process 9768: dbus message iterator looks uninitialized or corrupted
process 9768: arguments to dbus_message_iter_open_container() were incorrect, assertion "_dbus_message_iter_append_check (real)" failed in file ../../dbus/dbus-message.c line 2716.
This is normally a bug in some application using the D-Bus library.
process 9768: dbus message iterator looks uninitialized or corrupted
process 9768: arguments to dbus_message_iter_append_basic() were incorrect, assertion "_dbus_message_iter_append_check (real)" failed in file ../../dbus/dbus-message.c line 2521.
This is normally a bug in some application using the D-Bus library.
process 9768: dbus message iterator looks uninitialized or corrupted
process 9768: arguments to dbus_message_iter_append_basic() were incorrect, assertion "_dbus_message_iter_append_check (real)" failed in file ../../dbus/dbus-message.c line 2521.
This is normally a bug in some application using the D-Bus library.
process 9768: dbus message iterator looks uninitialized or corrupted
process 9768: arguments to dbus_message_iter_append_basic() were incorrect, assertion "_dbus_message_iter_append_check (real)" failed in file ../../dbus/dbus-message.c line 2521.
This is normally a bug in some application using the D-Bus library.
process 9768: dbus message iterator looks uninitialized or corrupted
process 9768: arguments to dbus_message_iter_close_container() were incorrect, assertion "_dbus_message_iter_append_check (real)" failed in file ../../dbus/dbus-message.c line 2783.
This is normally a bug in some application using the D-Bus library.
process 9768: dbus message iterator looks uninitialized or corrupted
process 9768: arguments to dbus_message_iter_close_container() were incorrect, assertion "_dbus_message_iter_append_check (real_sub)" failed in file ../../dbus/dbus-message.c line 2785.
This is normally a bug in some application using the D-Bus library.
process 9768: You can't recurse into an empty array or off the end of a message body
Erreur de segmentation (core dumped)
I did an identical modification (before looking at this post so its a really independant analysis) to message.cpp:
diff --git a/src/message.cpp b/src/message.cpp
index 3f0cac4..337fdad 100644
--- a/src/message.cpp
+++ b/src/message.cpp
@@ -350,7 +350,7 @@ void MessageIter::copy_data(MessageIter &to)
(
(DBusMessageIter ) & (to._iter),
from.type(),
- from.type() == DBUS_TYPE_VARIANT ? NULL : sig,
+ (( from.type() == DBUS_TYPE_VARIANT ) || ( from.type() == DBUS_TYPE_STRUCT )) ? NULL : sig,
(DBusMessageIter ) & (to_container._iter)
);
Now everything is running well. The answer is correctly interpreted.
What I think surprising is that this test:
from.type() == DBUS_TYPE_VARIANT ? NULL : sig
does not fit the request of the error message:
"(type == DBUS_TYPE_STRUCT && contained_signature == NULL) || (type == DBUS_TYPE_DICT_ENTRY && contained_signature == NULL) || (type == DBUS_TYPE_VARIANT && contained_signature != NULL) || (type == DBUS_TYPE_ARRAY && contained_signature != NULL)"
Why not writ it like this :
from.type() == DBUS_TYPE_DICT_ENTRY || from.type() == DBUS_TYPE_STRUCT? NULL : sig
?
As did schiebel, which seems to be the correct solution.
It seems that we are not the only ones to see this bug:
- it has been corrected in the "async" version maintained by sjames at git://gitorious.org/~sjames/dbus-cplusplus/async.git
- it has been recently repported on sourceforge at http://stackoverflow.com/questions/8753495/assertion-error-in-dbus-c-terminates-process
By the way, the dbus-c++ version used in Chromium has the same correction.
The log associated with the commit is at:
http://git.chromium.org/gitweb/?p=chromiumos/third_party/dbus-cplusplus.git;a=commit;h=32fe2ce6a60f6f9e5771c639598050798a4feae8
This quite common dbus interface is impossible to implement with dbus-c++ due to this bug: http://cgit.freedesktop.org/xdg/mpris-spec/tree/spec/org.mpris.MediaPlayer2.Player.xml
The "Metadata" property is "a{sv}". Using dbus-send or similar to get that property triggers the assertion failure.
I can also confirm that it works after applying the patch suggested above.