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
 
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_timeOr 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
 
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 in the function, maildir_uidlist_sync_next_partial, 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 help me get more understanding to these questions,
Sony