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 619975 - arrays get wrapped in variants in DBus results
arrays get wrapped in variants in DBus results
Status: RESOLVED FIXED
Product: gjs
Classification: Bindings
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gjs-maint
gjs-maint
Depends on:
Blocks:
 
 
Reported: 2010-05-28 19:36 UTC by Marina Zhurakhinskaya
Modified: 2010-06-07 17:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[dbus] Remove additional incorrect variant in GetAll (2.29 KB, patch)
2010-06-03 21:55 UTC, Colin Walters
committed Details | Review

Description Marina Zhurakhinskaya 2010-05-28 19:36:43 UTC
It appears that gjs is responsible for wrapping arrays in unnecessary variants in DBus results. This happens for ObserverChannelFilter property of the GNOME Shell Telepathy Client that implements the Observer interface.

The ObserverChannelsFilter is defined in gnome-shell/js/ui/telepathyClient.js as

    get ObserverChannelFilter() {
        return [ singleUserTextChannel, oneOrMoreUserTextChannel ];
    },

where, e.g.
let singleUserTextChannel = {};
singleUserTextChannel[Telepathy.CHANNEL_NAME + '.ChannelType'] = Telepathy.CHANNEL_TEXT_NAME;
singleUserTextChannel[Telepathy.CHANNEL_NAME + '.TargetHandleType'] = Telepathy.HandleType.CONTACT;

The signature for the method is defined in gnome-shell/js/misc/telepathy.js as

    properties: [
        { name: 'ObserverChannelFilter',
          signature: 'aa{sv}',
          access: 'read' }
    ]

The output of dbus-monitor shows that the extra variants get added into the result:

method call sender=:1.126 -> dest=org.freedesktop.Telepathy.Client.GnomeShell serial=577 path=/org/freedesktop/Telepathy/Client/GnomeShell; interface=org.freedesktop.DBus.Properties; member=GetAll
   string "org.freedesktop.Telepathy.Client.Observer"
method return sender=:1.165 -> dest=:1.126 reply_serial=577
   array [
      dict entry(
         string "ObserverChannelFilter"
         variant             array [
               variant                   array [
                     dict entry(
                        string "org.freedesktop.Telepathy.Channel.TargetHandleType"
                        variant                            int32 1
                     )
                     dict entry(
                        string "org.freedesktop.Telepathy.Channel.ChannelType"
                        variant                            string "org.freedesktop.Telepathy.Channel.Type.Text"
                     )
                  ]
               variant                   array [
                     dict entry(
                        string "org.freedesktop.Telepathy.Channel.TargetHandleType"
                        variant                            int32 0
                     )
                     dict entry(
                        string "org.freedesktop.Telepathy.Channel.ChannelType"
                        variant                            string "org.freedesktop.Telepathy.Channel.Type.Text"
                     )
                  ]
            ]
      )
   ]

Compare this to the format of a similar filter specification from Empathy:

method return sender=:1.168 -> dest=:1.126 reply_serial=597
   array [
      dict entry(
         string "HandlerChannelFilter"
         variant             array [
               array [
                  dict entry(
                     string "org.freedesktop.Telepathy.Channel.TargetHandleType"
                     variant                         int32 0
                  )
                  dict entry(
                     string "org.freedesktop.Telepathy.Channel.ChannelType"
                     variant                         string "org.freedesktop.Telepathy.Channel.Type.Text"
                  )
               ]
               array [
                  dict entry(
                     string "org.freedesktop.Telepathy.Channel.TargetHandleType"
                     variant                         int32 1
                  )
                  dict entry(
                     string "org.freedesktop.Telepathy.Channel.ChannelType"
                     variant                         string "org.freedesktop.Telepathy.Channel.Type.Text"
                  )
               ]
               ...
            ]
      )
   ]

The way we were specifying the filter did not cause any problems on F12, but it fails on F13 causing us not to get any message notifications, with 'MC_DEBUG=1 /usr/libexec/mission-control-5' indicating:

(process:24923): mcd-DEBUG: _mcd_client_proxy_observer_get_all_cb: org.freedesktop.Telepathy.Client.GnomeShell ObserverChannelFilter absent or wrong type, assuming no channels can match
Comment 1 Colin Walters 2010-06-03 21:55:34 UTC
Created attachment 162700 [details] [review]
[dbus] Remove additional incorrect variant in GetAll

The code in GetAll was giving "v" as the signature to conform
individual property values to, and ignoring the specified property
signature, which is wrong.

Instead, open a variant container, and pass the correct signature
when formatting a value.
Comment 2 Marina Zhurakhinskaya 2010-06-04 20:02:39 UTC
Thanks! This fixes the problem with the message notifications.
Comment 3 Colin Walters 2010-06-07 17:43:28 UTC
Attachment 162700 [details] pushed as d2c93ad - [dbus] Remove additional incorrect variant in GetAll