[Dovecot] dovecot expire doesn't work (?)

LÉVAI Dániel leva at ecentrum.hu
Thu Oct 30 17:28:05 EET 2008


On Monday 27 October 2008 14.26.50 LÉVAI Dániel wrote:
> Hi!
>
> I'm using dovecot-1.1.5 and trying to make the expire plugin work.
> What I've configured in dovecot.conf is the following:
>
> protocol imap,pop3,lda {
> 	mail_plugins = [...] expire
> }
>
> dict {
> 	expire = db:/var/dovecot/expire/expire.db
> }
>
>
> plugin {
>    expire = spamassassin/SPAM 2 spamassassin/HAM 2
>    expire_dict = proxy::expire
> }
>
> I have a sieve rule, to copy certain messages to my
> "spamassassin/SPAM" folder. Then I want to expire those messages
> after 2 days (I think I've configured that under the plugin{} section
> in dovecot.conf). So the actual message saving is done by the
> dovecot's deliver, but I have the plugin loaded under the "protocol
> lda {}" section too. So I thought now I just have to wait 2 days, and
> run the expire-tool, and then it will expire the messages.
> Now I have three messages dated back to 10.25, but running the
> expire-tool outputs nothing.
> # dovecot --exec-mail ext /usr/local/libexec/dovecot/expire-tool
> --test
>
> Nothing in the logfiles, and nothing on the console. I have the
> /var/dovecot/expire directory:
> # ls -la /var/dovecot/expire/
> total 1640
> drwx------  2 root  wheel       512 Oct 26 19:47:53 2008 ./
> drwxr-x---  3 root  wheel       512 Oct 27 07:57:42 2008 ../
> -rw-------  1 root  wheel     24576 Oct 27 13:00:01 2008 __db.001
> -rw-------  1 root  wheel     57344 Oct 27 13:00:01 2008 __db.002
> -rw-------  1 root  wheel    270336 Oct 27 13:00:01 2008 __db.003
> -rw-------  1 root  wheel     98304 Oct 27 13:00:01 2008 __db.004
> -rw-------  1 root  wheel     49152 Oct 27 13:00:01 2008 __db.005
> -rw-------  1 root  wheel     32768 Oct 26 19:47:37 2008 expire.db
> -rw-------  1 root  wheel  10485760 Oct 27 14:22:08 2008
> log.0000000001
>
> It contains the familiar BDB files, so I think it works, although the
> expire.db's modify time is yesterday, but deliver saved some messages
> also today to the spamassassin/SPAM folder.

I've got bitten by this:
The wiki[1] reads:

[...]
 - "%" works by matching any number of characters, but it stops at the 
hierarchy separator. Currently the separator is hardcoded to "/".
[...]
plugin {
  # Trash and its children 7d, Spam 30d
  expire = Trash 7 Trash/* 7 Spam 30
[...]

That is not exactly true. The separator which is working (as told me by 
e-frog, and as can be seen in the Maildir/ hierarchy) is the dot 
character (ie.: .).
My $USER/spamassassin/SPAM directory is not working as:
expire = spamassassin/SPAM 1
only as:
expire = spamassassin.SPAM 1

Also the dovecot-example.conf says:
"The following dict block maps dictionary names to URIs when the server 
is used. These can then be referenced using URIs in 
format "proxy:<name>"."

That is not true either, it must be "proxy::<name>" (note the two 
colons) or else dovecot won't even start.

Anyway, for the record, I should mention that while it is easy to check 
whether dovecot is fooling around with a mysql database, it is not so 
straightforward with BDB.
One can check if the Berkeley database is being used with db4_dump (or 
on some systems db4.7_dump or db4.6_dump and so on...):

$ db4_dump -d a expire.db
[...]
page 1: btree leaf: LSN [0][1]: level 1
        prev:    0 next:    0 entries:    0 offset: 16384

^^^ the above contains no entries, while:
$ db4_dump -da expire.db
[...]
page 1: btree leaf: LSN [1][84670]: level 1
        prev:    0 next:    0 entries:    2 offset: 16344
        [000] 16352 len:  29 data: shared/leva/spamassa...
        [001] 16344 len:   4 data: ��0x08I
^^^ this contains entries. Don't ask me what is the second row, 
though :), and also it is a PITA that the data gets trimmed.


On Wednesday 29 October 2008 15.53.24 Timo Sirainen wrote:
> On Wed, 2008-10-29 at 15:25 +0100, LÉVAI Dániel wrote:
> > When I ran `dovecot --exec-mail ext
> > /usr/local/libexec/dovecot/expire-tool --test', it told me that:
> > Info: leva/spamassassin.SPAM: stop, expire time in future:
> > 1225290174
>
> Sounds like it's working. It just wasn't time yet to expunge the
> oldest mail from there

Yep, now I can understand that, but what *is* weird, that the 
only "debug" information comes from this expire-tool when ran with 
the --test option. If I run it without it, it won't output anything 
anywhere. It would be nice to increase the logging for this (with or 
without the --test option), eg. when mail_debug=yes.


[1] - http://wiki.dovecot.org/Plugins/Expire

Daniel

-- 
LEVAI Daniel
PGP key ID = 0x4AC0A4B1
Key fingerprint = D037 03B9 C12D D338 4412  2D83 1373 917A 4AC0 A4B1


More information about the dovecot mailing list