notify-send returns zero error code when notify_notification_show call fails
NOTE! This is a copy/paste of https://bugzilla.gnome.org/show_bug.cgi?id=794001 due to the apparent non-acknowledgement of the bug (got lost in the changeover?).
https://bugzilla.gnome.org/attachment.cgi?id=369197 Created attachment 369197 [details] [review] A patch which should fix the issue. Tested on Arch Linux.
If a notify_notification_show call fails, the notify-send tool will not return an error code or show an error message.
notify_notification_show seems to be the place that fails if libnotify can't get to the DBus notification service, so this can lead to applications using notify-send sending notifications when they can't be sent.
To reproduce:
- Make sure you have nothing that implements org.freedesktop.Notifications running and nothing that will spawn it for you.
- Run some notification such as "notify-send Abc Def", and check it's status.
Results:
No message, error code 0, no notification.
Expected Results:
Error code non-zero, possibly a message in stderr. Still no actual notification, because the message is because the notification can't be sent.
Build Date & Hardware:
Build date is given as "2016-10-14 04:04 UTC" on https://www.archlinux.org/packages/extra/x86_64/libnotify/ - can't give more precise details.
Tested on Arch Linux with the latest libnotify release, but checking the git master sources shows it's still there. (If libnotify has changed when it acquires the DBus service info, this may be harder to reproduce, though.)
Additional Information: The attachment is a patch which seems to fix the bug. I've tested it in both the "notification daemon available" and "notification daemon not available" cases, along with both hint error cases - everything seems to work, and I'm not particularly sure how a patch like that would be tested further.