[DRE-maint] Bug#456564: libdbus-ruby: no dictionary support

Drake Wilson drake at begriffli.ch
Sun Dec 16 16:26:01 UTC 2007


Package: libdbus-ruby
Version: 0.2.0-1
Severity: wishlist
Tags: patch

This version of the Ruby DBus bindings throws a NotImplementedError
when trying to parse dictionaries (arrays of dict_entries), presumably
because it isn't implemented.  A patch is attached which attempts to
implement this.  Note that it does not check for dict_entries being
necessarily part of arrays, and I have not checked to see whether
other code checks for this.  At worst, a stray dict_entry that
violates the D-Bus specification may be deserialized as a two-element
array instead of as a dictionary.

   ---> Drake Wilson

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.22.2 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages libdbus-ruby depends on:
ii  libdbus-ruby1.8               0.2.0-1    Ruby 1.8 binding for D-Bus

libdbus-ruby recommends no packages.

-- no debconf information
-------------- next part --------------
diff -ur libdbus-ruby-0.2.0/lib/dbus/marshall.rb libdbus-ruby-new/lib/dbus/marshall.rb
--- libdbus-ruby-0.2.0/lib/dbus/marshall.rb	2007-05-26 06:43:50.000000000 -0500
+++ libdbus-ruby-new/lib/dbus/marshall.rb	2007-12-16 10:15:51.000000000 -0600
@@ -195,6 +195,13 @@
         while @idx - start_idx < array_sz
           packet << do_parse(signature.child)
         end
+
+        if signature.child.sigtype == Type::DICT_ENTRY then
+          packet = packet.inject(Hash.new) { |hash, pair|
+            hash[pair[0]] = pair[1]
+            hash
+          }
+        end
       when Type::STRUCT
         align(8)
         packet = Array.new
@@ -212,6 +219,11 @@
         packet = get_string
       when Type::SIGNATURE
         packet = get_signature
+      when Type::DICT_ENTRY
+        align(8)
+        key = do_parse(signature.members[0])
+        value = do_parse(signature.members[1])
+        packet = [key, value]
       else
         raise NotImplementedError,
         	"sigtype: #{signature.sigtype} (#{signature.sigtype.chr})"


More information about the Pkg-ruby-extras-maintainers mailing list