On 24.4.2014, at 0.51, Richard Platel rplatel@tucows.com wrote:
I posted to the list about this a while ago but never got a response, I have a bit more information now.
Dovecot 2.2.12 and other 2.2 versions are broken when using zlib and maildir. If messages are re-indexed, the INTERNALDATE of all messages is set to the time the re-index is done.
The problem seems to be in src/plugins/zlib/zlib-plugin.c in the function zlib_mail_cache_open.
During a reindex maildir_mail_get_received_date() does an i_stream_stat on the the i_stream_seekable stream created in zlib_mail_cache_open, but this istream does not know about the original maildir message file and always returns the current time for the file's stat times.
This is also broken on initial index, but if mail is indexed when it's received (ours isn't) it coincidentally gets the right time.
Thanks, fixed: http://hg.dovecot.org/dovecot-2.2/rev/9f1460682295