Menu

#190 call external program after each maildir file trained, or fix S= maildir filenames

open
nobody
None
5
2014-01-02
2013-08-25
No

I need sb_mboxtrain to call a user-specified external program after each maildir email file is trained, especially when its file contents are changed resulting in a changed file size. I need this because sb screws up dovecot / maildir by changing the file contents but not updating the S=<filesize> in the filename of some maildir messages. Then dovecot complains and majorly screws up (ongoing dovecot bug).

I have written a script to fix the filename and dovecot-uidlist entry for one email file, which if run directly after sb_mboxtrain trains an email (modifying the file) then makes everything OK for dovecot to run properly.

Ideally, sb_mboxtrain would fix the S= filename (and possibly the dovecot-uid entry) for me, but simply allowing a hook would be good enough.

I need the hook around line 150 (in maildir_train, after os.rename(tfn, cfn)) like:
subprocess.call(["/usr/local/script/maildir-dovecot-size-fix",cfn])

of course, the script name should be a command line argument, not hardcoded. Perhaps it could be hardcoded that it only gets one argument, cfn, passed to it. People could write wrappers around their programs if that wasn't sufficient.

maildir_train would also need a "import subprocess" also, of course.

This change would be very very easy to implement in the code. If it would help get this mainlined, I could have a go at making a patch, however, I'm not good at python at all. Thanks!

Discussion

  • Trevor Cordes

    Trevor Cordes - 2013-10-22

    My fix isn't working out that great as dovecot still screws up all the time on trained folders. There must be a bug in my fix-up scripts.

    The more I think about this problem, the more I think a "real" solution is required. Perhaps the best way is to have sb_mboxtrain keep a (separate) database of all the emails/files it has trained instead of trying to add a header to the actual maildir email files.

    The only other option I can think of is it perhaps IMAP/dovecot itself allows for editing an email via the protocol rather than through direct file access, then we could add headers that way.

    I'm surprised no one else is running into these problems. Does no one use sb_mboxtrain with dovecot on maildir files?

     
  • Trevor Cordes

    Trevor Cordes - 2014-01-02

    Please CLOSE this ticket. I have abandoned the original line of thinking and it is not a good solution.

    I have changed ideas and opened a new feature request #191 which implements my 2013-10-22 idea and provides a patch.

     

Log in to post a comment.