[Dovecot] mail-filter plugin v2.2 - corrupts IMAP indexes?

Charles Cazabon charlesc-dovecot at pyropus.ca
Wed Sep 18 02:33:36 EEST 2013


Hi,

I'm trying out the mail-filter plugin (v2.2, with Dovecot 2.2.5 built from
source), and it seems like any nontrivial filter causes some sort of index
corruption that breaks IMAP use.

i.e. using a null filter (basically `cat -`) for mail-filter.sh and
mail-filter-out.sh appears to work fine, and the debug logging shows it's
using the filters (though it reports the wrong Unix socket for one of them -
not sure if that's an actual bug or just a copy&paste error where it logs it;
there's a similar accidental use of the same Unix socket path in the readme
for the plugin):

  Sep 15 14:24:03 imap: Debug: Loading modules from directory:
      .../dovecot/lib/dovecot
  Sep 15 14:24:03 imap: Debug: Module loaded:
      .../dovecot/lib/dovecot/mail_filter_plugin.so
  Sep 15 14:24:03 imap(charlesc): Debug: Effective uid=1000, gid=1000,
      home=/home/charlesc
  Sep 15 14:24:03 imap(charlesc): Debug: mail_filter: Filtering mail_filter via
      socket .../dovecot/var/run/dovecot/mail-filter
  Sep 15 14:24:03 imap(charlesc): Debug: mail_filter: Filtering mail_filter_out
      via socket .../dovecot/var/run/dovecot/mail-filter

If I use a slightly more complex pair of filter scripts that just swap the
case of all alpha chars in the message body (not headers), so this pair of
filters results in the same output as the original message, something seems to
get corrupted in the indexes, and the IMAP process fails to respond correctly
to FETCH requests, and logs this:

  Sep 15 14:24:03 imap(charlesc): Debug: maildir++:
    root=.../Mail-test, index=, indexpvt=, control=,
    inbox=.../Mail-test, alt=
  Sep 15 14:24:03 imap(charlesc): Error: Cached message size smaller than
    expected (0 < 1092)
  Sep 15 14:24:03 imap(charlesc): Error: Maildir filename has wrong S value,
    renamed the file from
    .../Mail-test/new/1379276625.M25480P28541.ludmilla,S=0,W=1122 to
    .../Mail-test/new/1379276625.M25480P28541.ludmilla,S=1092
  Sep 15 14:24:03 imap(charlesc): Error: Corrupted index cache file
    .../Mail-test/dovecot.index.cache: Broken physical size for mail
    UID 5
  Sep 15 14:24:03 imap(charlesc): Error: read(BODY[]) failed: Invalid argument
    (FETCH  for mailbox INBOX UID 5)
  Sep 15 14:24:03 imap(charlesc): Info: Disconnected: FETCH failed in=105
    out=1176

It reports the size of the message changes, too, which is odd, as running the
filters manually confirms the output is identical to the input.
mail-filter.sh attached; mail-filter-out.sh is identical except using a
different temp file name to avoid clashes.

Am I doing something wrong?  How can I prevent this "Corrupted index cache
file" problem?

Thanks,

Charles

-- 
-----------------------------------------------------------------------
Charles Cazabon
GPL'ed software available at:               http://pyropus.ca/software/
-----------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mail-filter.sh
Type: application/x-sh
Size: 266 bytes
Desc: not available
URL: <http://dovecot.org/pipermail/dovecot/attachments/20130917/8dc168ea/attachment-0001.sh>


More information about the dovecot mailing list