Bug 1015900 - mailchecker fails with add_action() number of arguments
mailchecker fails with add_action() number of arguments
Product: Fedora
Classification: Fedora
Component: mailnag (Show other bugs)
x86_64 Linux
unspecified Severity unspecified
: ---
: ---
Assigned To: Thorsten Leemhuis
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2013-10-06 11:47 EDT by Barry Fishman
Modified: 2013-11-11 19:38 EST (History)
1 user (show)

See Also:
Fixed In Version: mailnag-0.5.2-4.fc20
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-11-11 19:38:40 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Fix for libnotify interface and GNOME 3.10 protocol changes. (1.47 KB, patch)
2013-10-25 11:52 EDT, Barry Fishman
no flags Details | Diff

External Trackers
Tracker ID Priority Status Summary Last Updated
GNOME Desktop 709524 None None None Never

  None (edit)
Description Barry Fishman 2013-10-06 11:47:46 EDT
Description of problem:

No new mail is seen when some exists.  The ~/.config/mailnag/mailnag.log
file show a python level error.

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

mailnag.noarch 0.5.2-2.fc20

How reproducible:


Steps to Reproduce:
1. run mailnag
2. no new mail when some exists
3. look in ~/.config/mailnag/mailnag.log

Actual results:

Checking 4 email account(s) at: Sun Oct  6 11:35:00 2013
KeyError exception for key 'Subject' in message.
Could not get subject from POP message.
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/Mailnag/mailnag.py", line 150, in poll_func
  File "/usr/lib/python2.7/site-packages/Mailnag/daemon/mailchecker.py", line 99, in check
  File "/usr/lib/python2.7/site-packages/Mailnag/daemon/mailchecker.py", line 148, in _notify_single
    n = self._get_notification(mail.sender, mail.subject, "mail-unread")
  File "/usr/lib/python2.7/site-packages/Mailnag/daemon/mailchecker.py", line 158, in _get_notification
    n.add_action("default", "default", self._notification_action_handler, None, None)
TypeError: add_action() takes exactly 5 arguments (6 given)

Expected results:

Just the first line shown.

Additional info:

Seems to be similar to bug 1010509 in where python fails
Comment 1 Barry Fishman 2013-10-09 12:17:48 EDT
The problem is related to the python import
  from gi.repository import Notify

and the add_action() interface code in the Notify object.

So might be better assigned to a pygobject or even the gobject-introspection package.
Comment 2 Thorsten Leemhuis 2013-10-09 12:26:34 EDT
(In reply to Barry Fishman from comment #1)

> So might be better assigned to a pygobject or even the gobject-introspection
> package.

Downgrading to libnotify 0.7.5 solves the problem for me; there are only small changes between 0.7.5 and 0.7.6 (one of them touching add_action), so I'd say that is the root of the problem (see Bug report in Gnomes bugzilla for details). Or am I missing something?
Comment 3 Barry Fishman 2013-10-10 09:29:55 EDT
As a work around I changed:


removing the last "None" argument in the two calls to add_notify().
Things now seems to work fine.

I have not been able to get my head around the pygobject code, I don't know where in the object tree the add_action() method exists.  The file:


gives add_notify 7 arguments (including the object), the last one being a
function to free the callbacks data argument.

There is some old discussion in the pygobject git log that the free function
did not seem to be needed, but nowhere did I see an API change explicitly
done (nor can I any code that would do it), and nobody in the gnome bugzilla seem to want to confirm a change.

However, if it is an API change, it means that all python applications
using gi.repository.Notify will need to be updated.
Comment 4 Barry Fishman 2013-10-10 11:07:39 EDT
In my previous message I overstated "seems to work".

Another error now causes the program to crash.  A test for the settings:
   org.gnome.shell saved-session-presence.

The code:

# play sound if it is enabled in mailnags settings and 
# gnome-shell notifications aren't disabled
if (self._cfg.get('general', 'playsound') == '1') and \
      (self._gsettings.get_int('saved-session-presence') != 2):
    gstplay(get_data_file(self._cfg.get('general', 'soundfile')))

Causes an abort

I patched this to test for the existance of the key first.

# play sound if it is enabled in mailnags settings and 
# gnome-shell notifications aren't disabled
if (self._cfg.get('general', 'playsound') == '1') and \
      ('saved-sesion-presence' in self._gsettings) and \
      (self._gsettings.get_int('saved-session-presence') != 2):
    gstplay(get_data_file(self._cfg.get('general', 'soundfile')))
avoiding the crash but also the sound.

Someone who knows what they are doing should really look at this. :-(
Comment 5 Barry Fishman 2013-10-10 15:51:40 EDT
I reported the bug upstream.  I have a patch, but neither bug tracking
system seems to be able to be able to deal with attachments.

My current code uses:

if (self._cfg.get('general', 'playsound') == '1') and \
      (('saved-sesion-presence' not in self._gsettings) or \
      (self._gsettings.get_int('saved-session-presence') != 2)):
    gstplay(get_data_file(self._cfg.get('general', 'soundfile')))
Comment 6 Barry Fishman 2013-10-25 11:52:00 EDT
Created attachment 816224 [details]
Fix for libnotify interface and GNOME 3.10 protocol changes.

The bug has been fixed in mailnag-next branch of the upstream repository git://github.com/pulb/mailnag.git.

That branch is a major code reorganization, and is under current development.  It might be better to fix the problem with something like my attached patch until a new upstream version is released.
Comment 7 Fedora Update System 2013-11-03 06:52:23 EST
mailnag-0.5.2-3.fc20 has been submitted as an update for Fedora 20.
Comment 8 Fedora Update System 2013-11-03 13:50:35 EST
Package mailnag-0.5.2-3.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing mailnag-0.5.2-3.fc20'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).
Comment 9 Barry Fishman 2013-11-04 17:12:15 EST
Two updates to Mailnag came through, and its is broken again.
Why didn't you use my damn patch!

See comment #4.  Gnome 3.14 no longer uses saved-session-presence.  Either
use my patch or remove the gsetting.get_int('save-session-presence') call.
Comment 10 Thorsten Leemhuis 2013-11-05 12:24:45 EST
(In reply to Barry Fishman from comment #9)
> Why didn't you use my damn patch!

There were basically two reasons I didn't take it
* I forgot about that problem (I'm human); that's why it's better to have one bug per problem
* it's unwise to mix fixes for different problems in one patch; it iirc is indirectly discouraged by the packaging guidelines

Whatever, doesn't matter. 

Is the sound part of you patch upstream committed somewhere or does the issue not exists in the master branch? And your patch afaics contains a typo:

+ (('saved-sesion-presence' not in self._gsettings) or \
Shouldn't that be "session"? If yes: Does the patch really work as indented?
Comment 11 Barry Fishman 2013-11-05 15:54:46 EST
Sorry for the tetchiness.

Yes, the patch worked as is, although the code has the mistake you noted.  But, neither saved-sesion-presence or saved-session-presence should be defined in self._gsettings.  A better change might be to remove the whole test, and use:

if (self._cfg.get('general', 'playsound') == '1'):
    gstplay(get_data_file(self._cfg.get('general', 'soundfile')))

When I diff-ed the new installed 'mailchecker.py' with my own file, the only other change I found was that installed file had extra trailing tabs in line 150.
The file has a lot of trailing space.

The fixes really should be applied upstream, but the author has moved on to developing the next version of the code.

I do respect your effort to keep the Fedora package working.
Comment 12 Fedora Update System 2013-11-06 12:55:23 EST
mailnag-0.5.2-4.fc20 has been submitted as an update for Fedora 20.
Comment 13 Fedora Update System 2013-11-11 19:38:40 EST
mailnag-0.5.2-4.fc20 has been pushed to the Fedora 20 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.