Richard Platel
2014-Feb-20 17:09 UTC
[Dovecot] dovecot with maildir not using mtime on reindex
Hi. It seems that dovecot is using the current time, not a maildir file's mtime for INTERNALDATE when a message is re-indexed: $ cd Index $ rm -rf .INBOX $ cd ../Maildir/cur $ stat * File: `1392914632.P54451Q0M08633.smtpin01,S=2215,W=2249:2,' Size: 960 Blocks: 8 IO Block: 1048576 regular file Device: 36h/54d Inode: 11132959 Links: 1 Access: (0600/-rw-------) Uid: ( 8/ mail) Gid: ( 8/ mail) Access: 2012-01-01 00:00:00.000000000 +0000 Modify: 2012-01-01 00:00:00.000000000 +0000 Change: 2014-02-20 16:46:20.000000000 +0000 Birth: - $ telnet imap01 143 Trying 10.5.45.1... Connected to imap01.dev.firefly.tucows.com. Escape character is '^]'. * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN] Dovecot ready. A LOGIN rplatel at ff-dev.com ******** A OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS SPECIAL-USE BINARY MOVE QUOTA] Logged in A SELECT INBOX * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) * OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft \*)] Flags permitted. * 1 EXISTS * 0 RECENT * OK [UNSEEN 1] First unseen. * OK [UIDVALIDITY 1265835133] UIDs valid * OK [UIDNEXT 4548] Predicted next UID A OK [READ-WRITE] Select completed (0.035 secs). A FETCH 1:* FULL * 1 FETCH (FLAGS () INTERNALDATE "20-Feb-2014 16:59:51 +0000" RFC822.SIZE 2249 ENVELOPE ("Thu, 20 Feb 2014 11:43:50 -0500" "Test message" (("Richard Platel" NIL "rplatel" "tucows.com")) (("Richard Platel" NIL "rplatel" "tucows.com")) (("Richard Platel" NIL "rplatel" "tucows.com")) ((NIL NIL "rplatel" "ff-dev.com")) NIL NIL NIL "<BED6EB46-CC88-4BDB-AE8B-98C1CDEAD67C at tucows.com>") BODY ("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 23 4)) A OK Fetch completed. A LOGOUT * BYE Logging out A OK Logout completed. Connection closed by foreign host. $ date Thu Feb 20 16:59:58 UTC 2014 Stracing the imap process, it seems dovecot does not stat the message file at all. Performing the above with an old dovecot 1 server yields the expected result, the INTERNALDATE of the message is the file's mtime. $ dovecot -n -c /he/dovecot/conf/dovecot.conf # 2.2.10.3: /he/dovecot/conf/dovecot.conf # OS: Linux 3.4.46-dom0-2.0.0 x86_64 Debian 7.0 debug_log_path = syslog disable_plaintext_auth = no first_valid_uid = 8 info_log_path = syslog lock_method = dotlock log_timestamp mail_fsync = always mail_gid = mail mail_nfs_index = yes mail_nfs_storage = yes mail_plugins = zlib quota tc_mail_log notify tc_proc mail_temp_dir = /var/run/dovecot_tmp mail_uid = mail maildir_very_dirty_syncs = yes managesieve_notify_capability = mailto managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date ihave mmap_disable = yes namespace inbox { inbox = yes location prefix } passdb { args = host=localhost port=1143 username=%L{user}::%L{service}::%L{rip}::%L{session} driver = imap } plugin { antispam_backend = pipe antispam_debug_target = syslog antispam_pipe_program = /he/dovecot/utils/he_spamtrain.pl antispam_pipe_program_args = --user=%u antispam_pipe_program_notspam_arg = --falsepositive antispam_pipe_program_spam_arg = --missed antispam_pipe_tmpdir = /var/run/dovecot_as_tmp antispam_signature_missing = move antispam_spam = Spam;Inbox.Spam;INBOX.Spam;Junk;INBOX.Junk antispam_trash_pattern_ignorecase = trash mail_log_events = delete undelete expunge copy mailbox_delete mailbox_rename flag_change append mail_log_fields = uid box msgid flags hetag memcached_servers = 10.5.47.223,10.5.47.222 zlib_save = gz zlib_save_level = 6 } protocols = imap pop3 service anvil { unix_listener anvil-auth-penalty { mode = 00 } } service imap-login { inet_listener imap { address = 0 } inet_listener imaps { port = 0 } process_limit = 29 process_min_avail = 14 service_count = 0 } service imap-postlogin { executable = script-login -d /he/dovecot/utils/post_login.sh } service imap { executable = imap imap-postlogin process_limit = 1270 vsz_limit = 0 } service pop3-login { inet_listener pop3 { address = 0 } inet_listener pop3s { port = 0 } process_limit = 29 process_min_avail = 14 service_count = 0 } service pop3-postlogin { executable = script-login -d /he/dovecot/utils/post_login.sh } service pop3 { executable = pop3 pop3-postlogin process_limit = 206 vsz_limit = 512 M } ssl = no userdb { args = /he/dovecot/conf/dovecot-tc-dict-auth.conf driver = dict } verbose_proctitle = yes protocol imap { mail_max_userip_connections = 30 mail_plugins = zlib quota tc_mail_log notify tc_proc imap_quota antispam } protocol pop3 { mail_max_userip_connections = 30 pop3_uidl_format = %08Xv%08Xu }
Richard Platel
2014-Feb-20 18:57 UTC
[Dovecot] dovecot with maildir not using mtime on reindex
Furthermore: it seems the behaviour is correct (mtime is used for internaldate) if the message is not compressed. On Feb 20, 2014, at 12:09 PM, Richard Platel <rplatel at tucows.com> wrote:> Hi. > > It seems that dovecot is using the current time, not a maildir file's mtime for INTERNALDATE when a message is re-indexed: > > $ cd Index > $ rm -rf .INBOX > $ cd ../Maildir/cur > $ stat * > File: `1392914632.P54451Q0M08633.smtpin01,S=2215,W=2249:2,' > Size: 960 Blocks: 8 IO Block: 1048576 regular file > Device: 36h/54d Inode: 11132959 Links: 1 > Access: (0600/-rw-------) Uid: ( 8/ mail) Gid: ( 8/ mail) > Access: 2012-01-01 00:00:00.000000000 +0000 > Modify: 2012-01-01 00:00:00.000000000 +0000 > Change: 2014-02-20 16:46:20.000000000 +0000 > Birth: - > $ telnet imap01 143 > Trying 10.5.45.1... > Connected to imap01.dev.firefly.tucows.com. > Escape character is '^]'. > * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN] Dovecot ready. > A LOGIN rplatel at ff-dev.com ******** > A OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS SPECIAL-USE BINARY MOVE QUOTA] Logged in > A SELECT INBOX > * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) > * OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft \*)] Flags permitted. > * 1 EXISTS > * 0 RECENT > * OK [UNSEEN 1] First unseen. > * OK [UIDVALIDITY 1265835133] UIDs valid > * OK [UIDNEXT 4548] Predicted next UID > A OK [READ-WRITE] Select completed (0.035 secs). > A FETCH 1:* FULL > * 1 FETCH (FLAGS () INTERNALDATE "20-Feb-2014 16:59:51 +0000" RFC822.SIZE 2249 ENVELOPE ("Thu, 20 Feb 2014 11:43:50 -0500" "Test message" (("Richard Platel" NIL "rplatel" "tucows.com")) (("Richard Platel" NIL "rplatel" "tucows.com")) (("Richard Platel" NIL "rplatel" "tucows.com")) ((NIL NIL "rplatel" "ff-dev.com")) NIL NIL NIL "<BED6EB46-CC88-4BDB-AE8B-98C1CDEAD67C at tucows.com>") BODY ("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 23 4)) > A OK Fetch completed. > A LOGOUT > * BYE Logging out > A OK Logout completed. > Connection closed by foreign host. > $ date > Thu Feb 20 16:59:58 UTC 2014 > > Stracing the imap process, it seems dovecot does not stat the message file at all. Performing the above with an old dovecot 1 server yields the expected result, the INTERNALDATE of the message is the file's mtime. > > $ dovecot -n -c /he/dovecot/conf/dovecot.conf > # 2.2.10.3: /he/dovecot/conf/dovecot.conf > # OS: Linux 3.4.46-dom0-2.0.0 x86_64 Debian 7.0 > debug_log_path = syslog > disable_plaintext_auth = no > first_valid_uid = 8 > info_log_path = syslog > lock_method = dotlock > log_timestamp > mail_fsync = always > mail_gid = mail > mail_nfs_index = yes > mail_nfs_storage = yes > mail_plugins = zlib quota tc_mail_log notify tc_proc > mail_temp_dir = /var/run/dovecot_tmp > mail_uid = mail > maildir_very_dirty_syncs = yes > managesieve_notify_capability = mailto > managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date ihave > mmap_disable = yes > namespace inbox { > inbox = yes > location > prefix > } > passdb { > args = host=localhost port=1143 username=%L{user}::%L{service}::%L{rip}::%L{session} > driver = imap > } > plugin { > antispam_backend = pipe > antispam_debug_target = syslog > antispam_pipe_program = /he/dovecot/utils/he_spamtrain.pl > antispam_pipe_program_args = --user=%u > antispam_pipe_program_notspam_arg = --falsepositive > antispam_pipe_program_spam_arg = --missed > antispam_pipe_tmpdir = /var/run/dovecot_as_tmp > antispam_signature_missing = move > antispam_spam = Spam;Inbox.Spam;INBOX.Spam;Junk;INBOX.Junk > antispam_trash_pattern_ignorecase = trash > mail_log_events = delete undelete expunge copy mailbox_delete mailbox_rename flag_change append > mail_log_fields = uid box msgid flags hetag > memcached_servers = 10.5.47.223,10.5.47.222 > zlib_save = gz > zlib_save_level = 6 > } > protocols = imap pop3 > service anvil { > unix_listener anvil-auth-penalty { > mode = 00 > } > } > service imap-login { > inet_listener imap { > address = 0 > } > inet_listener imaps { > port = 0 > } > process_limit = 29 > process_min_avail = 14 > service_count = 0 > } > service imap-postlogin { > executable = script-login -d /he/dovecot/utils/post_login.sh > } > service imap { > executable = imap imap-postlogin > process_limit = 1270 > vsz_limit = 0 > } > service pop3-login { > inet_listener pop3 { > address = 0 > } > inet_listener pop3s { > port = 0 > } > process_limit = 29 > process_min_avail = 14 > service_count = 0 > } > service pop3-postlogin { > executable = script-login -d /he/dovecot/utils/post_login.sh > } > service pop3 { > executable = pop3 pop3-postlogin > process_limit = 206 > vsz_limit = 512 M > } > ssl = no > userdb { > args = /he/dovecot/conf/dovecot-tc-dict-auth.conf > driver = dict > } > verbose_proctitle = yes > protocol imap { > mail_max_userip_connections = 30 > mail_plugins = zlib quota tc_mail_log notify tc_proc imap_quota antispam > } > protocol pop3 { > mail_max_userip_connections = 30 > pop3_uidl_format = %08Xv%08Xu > }