Bug 71743

Summary: dbus-send does not replace array; set method flaw?
Product: dbus Reporter: Paul Johnson <pauljohn>
Component: coreAssignee: Havoc Pennington <hp>
Status: RESOLVED NOTOURBUG QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Paul Johnson 2013-11-18 14:59:10 UTC
In Ubuntu 13.10, the version of dbus is 1.6.2. The window manager is compiz-0.9.10.

This weird behavior is that the array of wallpaper backgrounds is never replaced, but rather it is appended to. Thus it grows infinitely long.

pauljohn@dellap7:~$ dbus-send --print-reply --type=method_call --dest=org.freedesktop.compiz /org/freedesktop/compiz/wallpaper/screen0/bg_image org.freedesktop.compiz.get
method return sender=:1.72 -> dest=:1.74 reply_serial=2
   array [
      string "/home/pauljohn/Backgrounds/CC.jpg"
      string "/home/pauljohn/Backgrounds/DD.jpg"
   ]

pauljohn@dellap7:~$ dbus-send --print-reply --type=method_call --dest=org.freedesktop.compiz /org/freedesktop/compiz/wallpaper/screen0/bg_image org.freedesktop.compiz.set array:string:"A","B"
method return sender=:1.72 -> dest=:1.79 reply_serial=2
pauljohn@dellap7:~$ dbus-send --print-reply --type=method_call --dest=org.freedesktop.compiz /org/freedesktop/compiz/wallpaper/screen0/bg_image org.freedesktop.compiz.get
method return sender=:1.72 -> dest=:1.80 reply_serial=2
   array [
      string "/home/pauljohn/Backgrounds/CC"
      string "/home/pauljohn/Backgrounds/DD.jpg"
      string "A"
      string "B"
   ]

Notice this last one adds "A" "B" on the end, it does not replace. If you run dbus-send a few times, this can grow very long.

That's not expected (by me, at least), and it is not consistent with behavior outlined on the compiz page about this:

http://wiki.compiz.org/Plugins/Dbus
Comment 1 Simon McVittie 2013-11-18 15:40:14 UTC
(In reply to comment #0)
> In Ubuntu 13.10, the version of dbus is 1.6.2. The window manager is
> compiz-0.9.10.
> 
> This weird behavior is that the array of wallpaper backgrounds is never
> replaced, but rather it is appended to. Thus it grows infinitely long.

Please report this as a bug in compiz, or whatever plugin provides this D-Bus API.

For this to be dbus-send's fault, it would have to call the "get" method to get the items, then include them in the "set" message deliberately... but it's a very simple program and has no idea how to do that :-)

The implementation of the "set" method is probably iterating through items in the array and appending them to an internal list. If it's going to do that, it should empty its internal list before iterating through the array.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.