diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-08-31 19:49:30 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-09-07 17:34:11 +0100 |
commit | 0bb531d7856f4b79edd7d328cef59e58f7f08ac8 (patch) | |
tree | 8b3ae7ea4b9cfe7d9c0b71e9593b8b286509daac | |
parent | 0675c366c5b326d50a1ad7f368ee47c4219a47bd (diff) | |
download | telepathy-mission-control-0bb531d7856f4b79edd7d328cef59e58f7f08ac8.tar.gz |
servicetest: don't eavesdrop on method replies or errors
Eavesdropping on method replies breaks libdbus if you call methods using the
same connection. You can get into a situation like this:
* Test calls a method on MC; say the serial number is 42
* At around the same time, MC calls a method on gnome-keyring and also uses
serial number 42
* gnome-keyring replies, labelled "in reply to 42"
* Test is eavesdropping, so it sees the reply going from gnome-keyring to MC
* Test interprets the reply from gnome-keyring to MC as the reply it was
expecting from MC, sees completely the wrong types, and becomes
confused
This seems unlikely - but because serial numbers are sequential and
start from 1 for each connection (as opposed to starting from a random
offset), two connections can quite easily happen to sync up. I saw it
happen most recently in the gnome-keyring test. With the benefit
of hindsight, I think I've seen this before: whenever the tests
made an Introspect() call which returned a type other than 's', that
was probably this bug.
We never actually generated events for messages other than signals and
method calls, so match those ones specifically, and don't eavesdrop on
replies.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54495
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
-rw-r--r-- | tests/twisted/servicetest.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/twisted/servicetest.py b/tests/twisted/servicetest.py index c0c63ed3..60418312 100644 --- a/tests/twisted/servicetest.py +++ b/tests/twisted/servicetest.py @@ -316,12 +316,12 @@ class IteratingEventQueue(BaseEventQueue): try: # for dbus > 1.5 - bus.add_match_string("eavesdrop=true") + bus.add_match_string("eavesdrop=true,type='signal'") except dbus.DBusException: - pass - - # for dbus 1.4 - bus.add_match_string("") + bus.add_match_string("type='signal'") + bus.add_match_string("type='method_call'") + else: + bus.add_match_string("eavesdrop=true,type='method_call'") bus.add_message_filter(self._dbus_filter_bound_method) |