Some questions about code in lib-storage/index/maildir

songliny songliny at synology.com
Thu Mar 18 17:57:27 EET 2021


Hi, Recently, I have read some code in dovecot 2.3.13. And I have 2 questions about some lines of code in lib-storage/index/maildir Firstly, in the function, maildir_scan_dir, from lib-storage/index/maildir/maildir-sync.c around line 575 (https://github.com/dovecot/core/blob/6986a435e31dfe5bcd14985534b76b3c735f7831/src/lib-storage/index/maildir/maildir-sync.c#L575) I would like to know that after successfully stat the cur directory, does it assign the max value between st.st_mtime and start_time intensionally to new_check_time? Or maybe should it assign the value to the cur_check_time. if (stat(ctx->cur_dir, &st) == 0) { ctx->mbox->maildir_hdr.new_check_time = I_MAX(st.st_mtime, start_time); ctx->mbox->maildir_hdr.cur_mtime = st.st_mtime; ctx->mbox->maildir_hdr.cur_mtime_nsecs = ST_MTIME_NSEC(st); } Secondly, in the function, maildir_uidlist_sync_next_uid, from lib-storage/index/maildir/maildir-uidlist.c (https://github.com/dovecot/core/blob/6986a435e31dfe5bcd14985534b76b3c735f7831/s

rc/lib-storage/index/maildir/maildir-uidlist.c#L1760) Is it ok to remove MAILDIR_UIDLIST_REC_FLAG_NEW_DIR flag from the record for the record that is not found in ctx->files just like the behavior (https://github.com/dovecot/core/blob/6986a435e31dfe5bcd14985534b76b3c735f7831/src/lib-storage/index/maildir/maildir-uidlist.c#L1723)in the function, maildir_uidlist_sync_next_partial (https://github.com/dovecot/core/blob/6986a435e31dfe5bcd14985534b76b3c735f7831/src/lib-storage/index/maildir/maildir-uidlist.c#L1723), from the same file? I think when it gets to the function, maildir_uidlist_sync_next_uid, the mail file have already been moved to cur directory. And maybe it is ok to remove MAILDIR_UIDLIST_REC_FLAG_NEW_DIR flag from the record. That is, is it ok to add this line rec->flags &= ENUM_NEGATE(MAILDIR_UIDLIST_REC_FLAG_NEW_DIR); just before rec->flags = (rec->flags | flags) & ENUM_NEGATE(MAILDIR_UIDLIST_REC_FLAG_NONSYNCED); in maildir_uidlist_sync_next_uid? Thank you in advance to he

lp me get more understanding to these questions, Sony
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://dovecot.org/pipermail/dovecot/attachments/20210318/7e8e4069/attachment-0001.html>


More information about the dovecot mailing list