On Jul 18, 2018 um 15:05:46, Joseph Tam wrote:
On Wed, 18 Jul 2018, Sophie Loewenthal wrote:
Why did my 'doveadm expunge' command not clear the Trash out of a mailbox?
The oldest messages was put into the Trash on the 26th June 2018 as shown in the file timestamp.
-rw------- 1 vmail mail 33056 Jun 26 16:46 1530031582.M768773P18242.mx10,S=33056,W=33510:2,RS
# doveadm -D expunge -u testuser@example.org mailbox Trash savedbefore 2d
I was going to suggest that you dump the savedbefore dates on all your messages to see what Dovecot thinks your message's timestamps are. I tried it out myself and was surprised to find *all* messages in *any* mailbox I looked at gave the same timestamp -- probably that of the latest message.
For example,
# doveadm -f tab fetch -u {user} "uid date.saved" mailbox Trash uid date.saved 23624 2018-07-18 14:50:03 23625 2018-07-18 14:50:03 [... 3657 lines removed ...] 27295 2018-07-18 14:50:03 27296 2018-07-18 14:50:03 27297 2018-07-18 14:50:03
# doveadm -f tab fetch -u {user} "uid date.saved" mailbox INBOX uid date.saved 94878 2018-07-18 14:53:46 100366 2018-07-18 14:53:46 [... 140 lines removed ...] 102313 2018-07-18 14:53:46 102314 2018-07-18 14:53:46 102315 2018-07-18 14:53:46
This would explain why the cron script I use to blow away old deleted mail has not fired in ages.
Is this a bug, or am I not understanding what "savedbefore" means now? It certainly has changed behaviour since <2.2, since my script used to work before.
Hello Joseph,
here works a dovecot 2.2.27 on a raspberrypi and the behaviour is as expected.
doveadm -f tab fetch -u <user> "uid date.saved" mailbox Trash uid date.saved 314 2018-06-23 00:35:59 315 2018-06-23 12:39:10 316 2018-06-24 10:32:43 317 2018-06-24 10:32:43 318 2018-06-24 10:32:47 319 2018-06-24 14:26:24 320 2018-06-24 14:26:24 321 2018-06-24 14:28:45 322 2018-06-24 14:28:45 -- lines skipped 574 2018-07-20 20:58:21 575 2018-07-21 17:22:17 576 2018-07-22 15:15:18 577 2018-07-22 15:28:28 578 2018-07-22 15:28:28 579 2018-07-22 15:28:28 580 2018-07-22 16:12:47 581 2018-07-23 13:27:12 582 2018-07-23 12:55:26 583 2018-07-23 13:19:01 584 2018-07-23 13:19:01 585 2018-07-23 13:49:01 586 2018-07-23 13:52:46
And I have a cron script that expunges the mails older than 30 days.
/usr/bin/doveadm expunge -u <user> mailbox Trash savedbefore 30d
Michael