← Back to team overview

touch-packages team mailing list archive

[Bug 1223401] Re: [0.7.6] the add_action api changed creating issues for clients

 

So, this madness needs to stop at some point, so let's just fix the
reverse dependencies and get back in sync. This should be much easier
now that PyGObject makes tailing "allow-none" arguments optional and
accepts not specifying them explicitly at all. However, we must pay
attention as trailing arguments are now considered as user_data list,
and passed to callbacks.

[1] Skipping user_data and free_func:
  python3 -c 'from gi.repository import GLib, Notify; Notify.init("test"); n = Notify.Notification.new("summary", "msg"); n.add_action("my-id", "my_label", (lambda n, id, userdata: print(id, userdata)), None, None); n.show(); GLib.MainLoop().run()'

Wrongly gives "None" as user-data in the callback on Ubuntu, but no
user_data callback argument at all with the upstream API.

[2] Specifying user_data, skipping free_func:
  python3 -c 'from gi.repository import GLib, Notify; Notify.init("test"); n = Notify.Notification.new("summary", "msg"); n.add_action("my-id", "my_label", (lambda *u: print(u)), "foo"); n.show(); GLib.MainLoop().run()'

Gives "foo" as user_data in the callback for both upstream and Ubuntu.

[3] Specifying both user_data and free_func:
  python3 -c 'from gi.repository import GLib, Notify; Notify.init("test"); n = Notify.Notification.new("summary", "msg"); n.add_action("my-id", "my_label", (lambda *u: print(u)), "foo", None); n.show(); GLib.MainLoop().run()'

Gives "foo", None as two user_data callback args upstream, but just
"foo" on Ubuntu, as the extra None is interpreted as free_func.

I checked all rdepends of gir1.2-notify-0.7. "n/a" means the package
doesn't use add_action() at all.

autokey: n/a
blueman: OK; explicit None user_data, callback ignores *args
firewall-applet: n/a
friends-dispatcher: n/a
gnome-music: OK (case [2]), explicit None user_data, callback expects one user_data arg
gnome-tweak-tool: BROKEN on ubuntu (case [3]), supplies and expects two user_data args
landscape-client-ui: n/a
lubuntu-software-center: n/a
mailnag: OK (case [1]), passes and expects 1 user_data
nautilus-pastebin: n/a
pitivi: n/a
solaar: n/a
system-config-printer-gnome: BROKEN on ubuntu (case [1]), supplies and expects no user_data
transmageddon: n/a
unity-mail: n/a
unity8-autopilot: BROKEN with upstream, case [3], supplies two user_data, expects one in callback

So in summary, we need to fix
tests/autopilot/unity8/shell/emulators/create_interactive_notification.py
in unity8-autopilot, then sync libnotify, then system-config-printer and
gnome-tweak-tool will get fixed and we finally are back to one and the
same API everywhere.

** Also affects: unity8 (Ubuntu)
   Importance: Undecided
       Status: New

** Changed in: unity8 (Ubuntu)
     Assignee: (unassigned) => Martin Pitt (pitti)

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to libnotify in Ubuntu.
https://bugs.launchpad.net/bugs/1223401

Title:
  [0.7.6] the add_action api changed creating issues for clients

Status in libnotify package in Ubuntu:
  Confirmed
Status in unity8 package in Ubuntu:
  New

Bug description:
  That upstream change seems an api change:
  https://git.gnome.org/browse/libnotify/commit/?id=2b4ab4d22f42dd264a4ddfa68b02bba0d6c71b0b

  Simple testcase:

  "from gi.repository import GLib, Notify

  def action_callback():
      print action_id
  notification = Notify.Notification.new("", "", "")
  notification.add_action("one", "two", action_callback, None, None)"

  that code worked before and is complaining about the number of
  arguments (5 instead of 6) after the update

  We reverted the change because it was creating problems in unity8
  tests (and likely in code in the archive).

  Before dropping the revert we should probably figure out if:
  - the upstream change is correct is buggy
  - why the number of argument changed (it seems from the commit it shouldn't)
  - what in the archive use that api and needs to be ported
  - how we can make code support both old/new apis at the same time

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/libnotify/+bug/1223401/+subscriptions