Cinnamon: Notification daemon crash when `image-path` hint contains an icon name

Created on 21 Apr 2018  ·  3Comments  ·  Source: linuxmint/cinnamon

```

  • Cinnamon Cinnamon 3.6.7
  • Distribution Linux Mint 18.3 Sylvia
  • 64 bit
    ```

Issue

The notification daemon doesn't support icon names.

On the application side, I use GApplication to send notifications. I set an icon using this kind code:

icon = g_themed_icon_new("edit-copy");
g_notification_set_icon(notif, icon);
g_application_send_notification(app, "notif-id", notif);

This code will basically crash my application. The crash is due to a bug in glib, which is triggered because the send_notification() times out. It times out because the Cinnamon notification daemon doesn't reply anymore, and probably crashed as well.

I tracked that as much as I could. On the caller side first (ie. glib), we can see that support for GThemedIcon was discussed in Bug 745634, and added in glib ec1edef3.

Now if you look into this file you can see that the implementation will ultimately save the icon in the image-path hint. Which leads us to the steps to reproduce...

Steps to reproduce

So we can re-create the dbus call that is send by g_application_send_notification(). As for the image, we can either use a full path (that's what you get if the caller used GFileIcon), or simply the filename without the extension (that's what you get if the caller used GThemedIcon).

Setting a full path works:

IMAGE=/usr/share/icons/Adwaita/48x48/actions/edit-copy.png
python -c "import dbus; print dbus.Bus().call_blocking(\
    'org.freedesktop.Notifications', \
    '/org/freedesktop/Notifications', \
    'org.freedesktop.Notifications', \
    'Notify', \
    'susssasa{sv}i', \
    ('appname', 0, '', 'summary', 'body', [], {'image-path': '$IMAGE'}, -1))"

Setting an icon name doesn't, there is no notification displayed:

IMAGE=edit-copy
python -c ... # copy-paste the snippet above

Other information

It's up to you to decide if you want to support Themed Icon or not in your notification daemon, but at least the notification daemon should handle gracefully any junk input that is send by applications in the image-path hint.

I added some logs in the Cinnamon Javascript, and I ended up here in the file js/ui/notificationDaemon.js:

       } else if (hints['image-path']) {
           return textureCache.load_uri_async(GLib.filename_to_uri(hints['image-path'], null), size, size);

This call never returns because GLib.filename_to_uri raises an exception that is not handled. I noticed that there's a few of this call in the file, where exceptions are not handled.

I added a try catch statement, however the notification is still not displayed. I didn't go further.

Hope this helps, feel free to ping me for more details. Cheers,

Arnaud

BUG BUG REPRODUCED

Most helpful comment

@icarter09 Yes it's still an issue here, fedora uses @itzexor WIP to fix it

https://github.com/itzexor/Cinnamon/commit/d56f1cca19867dfa44b79e654f729d2f27319e1f

All 3 comments

@elboulangero are you still experiencing this issue?

@icarter09 Sorry I found that out only while doing some testing in a Cinnamon VM, after user reported a crash with Goodvibes on Cinnamon. I don't run Cinnamon myself so I can't say.

This being said I thing you can try the "Steps to reproduce" above to see if it's still an issue

cheers

@icarter09 Yes it's still an issue here, fedora uses @itzexor WIP to fix it

https://github.com/itzexor/Cinnamon/commit/d56f1cca19867dfa44b79e654f729d2f27319e1f

Was this page helpful?
0 / 5 - 0 ratings