Bug 693362 - Notifications using notify-send instead of libnotify
Notifications using notify-send instead of libnotify
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: xchat (Show other bugs)
15
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Christopher Aillon
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2011-04-04 08:39 EDT by Andrew Hutchings
Modified: 2011-04-15 17:14 EDT (History)
5 users (show)

See Also:
Fixed In Version: xchat-2.8.8-9.fc15
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-04-15 17:14:29 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
Load the correct library (778 bytes, patch)
2011-04-07 18:32 EDT, Christopher Aillon
no flags Details | Diff
Better patch, link directly against libnotify (untested) (7.31 KB, patch)
2011-04-07 20:37 EDT, Christopher Aillon
no flags Details | Diff
Better patch, link directly against libnotify (10.45 KB, patch)
2011-04-07 22:59 EDT, Christopher Aillon
no flags Details | Diff

  None (edit)
Description Andrew Hutchings 2011-04-04 08:39:47 EDT
Description of problem:

Notifications appear to be using notify-send instead of libnotify which means that every notification creates a new icon in the bottom of gnome-shell.

Version-Release number of selected component (if applicable):

xchat-2.8.8-7.fc15.x86_64 (also tested i686)

How reproducible:

100%

Steps to Reproduce:
1. Enable tray balloon notifications in xchat
2. have a notification happen.
  
Actual results:
New notify-send notification forked with an xchat icon for every notification.

Expected results:
Use the xchat icon already present for notifications.
Comment 2 Kevin Kofler 2011-04-04 08:55:29 EDT
This patch is already applied in xchat-2.8.8-7.fc15. Looks like it doesn't work.
Comment 3 Andrew Hutchings 2011-04-04 09:03:11 EDT
ah, cool that the patch is in there, I haven't had a chance to look into the SRPM to diagnose properly yet.  I wonder what is going wrong then.

It is only a minor annoyance when waking up and finding 20 odd Freenode notifications/icons.  If there is a way to clear them all in one go that would also make me happy :)
Comment 4 Kevin Kofler 2011-04-07 14:39:57 EDT
CCing the author of the non-working patch.
Comment 5 Christopher Aillon 2011-04-07 15:56:14 EDT
You need to uncheck "Enable system tray icon" in your xchat preferences.
Comment 6 Andrew Hutchings 2011-04-07 16:28:44 EDT
Hi Christopher,

That got rid of the tray icon which is also there, but it still uses notify-send :(
Comment 7 Christopher Aillon 2011-04-07 17:40:31 EDT
Ugh, I see the problem...

xchat is dynamically loading libnotify like so:

  nn_mod = g_module_open ("libnotify.so.1", G_MODULE_BIND_LAZY);

but:

% rpm -ql libnotify | grep so
/usr/lib64/libnotify.so.4
/usr/lib64/libnotify.so.4.0.0
Comment 8 Andrew Hutchings 2011-04-07 17:48:36 EDT
Hi Christopher,

Nice find.  I quickly added a symlink for that and that made it work.
Comment 9 Christopher Aillon 2011-04-07 18:32:45 EDT
Created attachment 490659 [details]
Load the correct library

So, here's a fuller analysis with a patch.

During my first glance, I missed another g_module_open call a few lines above the g_module_open that I quoted.

The code first does

   nn_mod = g_module_open ("libnotify", G_MODULE_BIND_LAZY);

which looks for "libnotify" which fails, then "libnotify.so" which fails, then "libnotify.la" which fails.

Then, it looks for "/usr/lib64/libnotify.so".

On developer systems with libnotify-devel, this file exists, so it happily loads libnotify support for us.  However, on user systems, this does not exist which leads to that g_module_open call outright failing.  This explains why it appeared to be working for me and presumably Owen too, but not for you.

Then, it goes and tries to load the versioned module.  Naturally, that fails.  At that point, it then falls back to use notify-send.

I'm not sure the motivations for dynamically loading the library instead of linking directly, but I think a correct minimalistic fix is to do:

-     nn_mod = g_module_open ("libnotify", G_MODULE_BIND_LAZY);
+     nn_mod = g_module_open ("libnotify.so.4", G_MODULE_BIND_LAZY);

This adds the newest versioned library at the top of the check, and still keeps the old versioned library.  However, it also removes the devel only library from the list which reduces the chances that developers will be blind to this issue in the future.  There's no real reason to look there anyway since most users just won't have that installed.

I've performed a scratch build with this fix available here: http://koji.fedoraproject.org/koji/taskinfo?taskID=2982847
Comment 10 Christopher Aillon 2011-04-07 18:41:50 EDT
(it still doesn't really solve the underlying problem that the so version could change at any point in the future, and this bug would come back again, but we'd need to a rebuild at that point anyway... direct linking would make it really easy to spot, though, whereas the dynamic loading only sort of masks the issue.)
Comment 11 Andrew Hutchings 2011-04-07 18:48:59 EDT
Thanks for working on this so quick.  Finding it really hard to find fault with Fedora 15 now ;)

Will be using it to give talks at the MySQL UC next week so ultimate test for me :)
Comment 12 Christopher Aillon 2011-04-07 20:37:58 EDT
Created attachment 490670 [details]
Better patch, link directly against libnotify (untested)

I built the previous minimal patch as xchat-2.8.8-8.fc15.

That said, I think this is the better patch, and what should get sent upstream.  As notify-send is provided by libnotify, it doesn't really make sense to expect that to be there but not the library directly.  We already would need to update the build for when the soname changes, so we might as well get automatic detection by linking directly against it.  And the code becomes cleaner this way.
Comment 13 Christopher Aillon 2011-04-07 20:38:30 EDT
(In reply to comment #12)
> Created attachment 490670 [details]
> Better patch, link directly against libnotify (untested)

Note, I've compile tested this both with and without libnotify, just haven't run tested it yet.
Comment 14 Christopher Aillon 2011-04-07 22:59:22 EDT
Created attachment 490680 [details]
Better patch, link directly against libnotify

Updated patch, compiles and tested to work.
Comment 15 Fedora Update System 2011-04-07 23:43:05 EDT
xchat-2.8.8-9.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/xchat-2.8.8-9.fc15
Comment 16 Christopher Aillon 2011-04-08 20:33:14 EDT
Comment on attachment 490680 [details]
Better patch, link directly against libnotify

submitted upstream as http://sourceforge.net/tracker/?func=browse&group_id=239&atid=100239
Comment 17 Fedora Update System 2011-04-09 01:29:32 EDT
Package xchat-2.8.8-9.fc15:
* should fix your issue,
* was pushed to the Fedora 15 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing xchat-2.8.8-9.fc15'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/xchat-2.8.8-9.fc15
then log in and leave karma (feedback).
Comment 18 Fedora Update System 2011-04-15 17:14:24 EDT
xchat-2.8.8-9.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.