[Dovecot] Deleting messages from MailDir

Timo Sirainen tss at iki.fi
Wed Feb 13 07:55:07 EET 2008


On Feb 13, 2008, at 7:21 AM, Benjamin R. Haskell wrote:

> On Wed, 13 Feb 2008, Rody wrote:
>> Op woensdag 13 februari 2008 00:43, schreef Bill Cole:
>>> Yes, but you may also care that ctime is reset when a client has
>>> Dovecot move a message from one subfolder to another within a
>>> Maildir. I'm not sure why Dovecot does it, but a look at the  
>>> messages
>>> in the non-INBOX parts of my Maildir reveals that the ctime is  
>>> always
>>> later than the mtime, and the contents (Received headers) makes it
>>> clear that Dovecot sets the mtime of messages to the original mtime
>>> (i.e. original delivery time) when copying them.
>>>
>
> I think the answer to "why Dovecot does it" is actually that Dovecot  
> doesn't do anything with ctime. Under most *nix filesystems, ctime  
> is the last time the inode underlying the file/dir was changed ('c'  
> for "changed", not "created" -- [usually]). The inode gets changed  
> when the file's moved from one directory to another.

Right. Also there's no way to change ctime even if I wanted to.

> The delivery time can also be determined by the first part of the  
> Maildir filename of the message:
>
> e.g. ls -l 1202878863.24522_1.myhost:2,
> --rw------- 1 user group 551 2008-02-13 00:00  
> 1202878863.24522_1.myhost:2,
>
> The 1202878863 part is the Unix timestamp corresponding to midnight,  
> Feb 13, 2008 EST. So, it's not really a requirement of Maildir's  
> design to keep the mtime updated. It's just easier+quicker than  
> parsing the number out of the filename (where it *is* a requirement).

It's required to write it, but it's also required that you shouldn't  
assume anything about the filename when reading it. So for example  
some mbox -> maildir convertors use "mbox.#" as filenames and they  
work fine.

>> [...] It looks like the use of ctime or mtime depends on wether you  
>> want the message removed x days after it was moved to say the trash  
>> folder (ctime) or will be removed x days after it originally  
>> arrived in the inbox (mtime). My personal opinion is currently that  
>> i would like it removed x days after it was placed in a certain  
>> folder, hence i use ctime.
>
> Depends on the context for me. If it's in a spam folder, I'd rather  
> not keep it around any longer than it'd take for someone to say  
> "Hey, didn't you get that?". So -mtime +13 (2 weeks from receipt).  
> (Thanks for the heads-up on +13 vs. +14, btw).

Also note that if messages are uploaded to server by IMAP client the  
mtime may be the message's original date. Dovecot uses mtime as the  
message's IMAP INTERNALDATE.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20080213/245ea6e8/attachment-0001.bin 


More information about the dovecot mailing list