On Wed, Jan 14, 2009 at 10:18:30AM -0500, Timo Sirainen wrote:
but unfortunately, I'm not enough of a programmer, so I have to ask here: Should I be able to delete mails from a maildir, and expect the quota plugin to notice the change?
I think it should notice most times, but not necessarily always. Can you reproduce this with simple steps? Meaning that if maildirsize file is either older than 15 minutes or longer than two lines, does Dovecot not recalculate the quota when user is over quota?
Yes, I can. However, the user is, strictly speaking, not over quota, since there are still a few bytes free. The new message would push it over quota, though. Does this make a difference?
These are the steps I took, starting from a "fresh" account (one whose home directory I deleted), and using swaks[0] to generate the mails. We use Postfix to pipe the messages to deliver, and have set quota_full_tempfail = yes.
Delete the user's home directory
Deliver 3 messages to the user, using
swaks -f ulrich@topfen.net -t grmpfl@example.net -s localhost
- maildirsize now shows:
cat Maildir/maildirsize
2000S 0 0 510 1 510 1 510 1
- Try to deliver a fourth message (also 510 bytes). As expected, it fails.
tail -n 2 /var/log/mail.log
Jan 14 17:15:02 carolyn deliver(grmpfl@example.net): msgid=20090114161502.7F2AA1C104@carolyn.beispiel.at: save failed to INBOX: Quota exceeded (mailbox for user is full) Jan 14 17:15:02 carolyn postfix/pipe[8461]: 7F2AA1C104: to=grmpfl@example.net, relay=dovecot, delay=0.18, delays=0.12/0.03/0/0.03, dsn=4.3.0, status=deferred (temporary failure. Command output: Quota exceeded (mailbox for user is full) )
- Remove one of the files:
rm Maildir/new/1231949258.M463705P8296.carolyn\,S\=510\,W\=524
- Try to deliver the message again, and watch it fail again:
postqueue -f
# tail -n 2 /var/log/mail.log Jan 14 17:15:55 carolyn deliver(grmpfl@example.net): msgid=20090114155631.BCDB71C0DA@carolyn.beispiel.at: save failed to INBOX: Quota exceeded (mailbox for user is full) Jan 14 17:15:55 carolyn postfix/pipe[8461]: BCDB71C0DA: to=grmpfl@example.net, relay=dovecot, delay=1164, delays=1164/0.04/0/0.02, dsn=4.3.0, status=deferred (temporary failure. Command output: Quota exceeded (mailbox for user is full) )
- Try ageing maildirsize and a new delivery:
touch -t 01010101 Maildir/maildirsize
# postqueue -f # tail -n 2 /var/log/mail.log Jan 14 17:18:42 carolyn postfix/pipe[8553]: 7F2AA1C104: to=grmpfl@example.net, relay=dovecot, delay=220, delays=220/0.05/0/0.03, dsn=4.3.0, status=deferred (temporary failure. Command output: Quota exceeded (mailbox for user is full) ) Jan 14 17:18:42 carolyn postfix/pipe[8554]: BCDB71C0DA: to=grmpfl@example.net, relay=dovecot, delay=1331, delays=1331/0.01/0/0.03, dsn=4.3.0, status=deferred (temporary failure. Command output: Quota exceeded (mailbox for user is full) )
- Try deleting maildirsize and a new delivery:
rm Maildir/maildirsize
# tail -n 3 /var/log/mail.log Jan 14 17:19:48 carolyn deliver(grmpfl@example.net): msgid=20090114161502.7F2AA1C104@carolyn.beispiel.at: saved mail to INBOX Jan 14 17:19:48 carolyn postfix/pipe[8553]: 7F2AA1C104: to=grmpfl@example.net, relay=dovecot, delay=286, delays=286/0.04/0/0.13, dsn=2.0.0, status=sent (delivered via dovecot service) Jan 14 17:19:48 carolyn postfix/qmgr[3599]: 7F2AA1C104: removed