dovecot.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview
thread

None

None

11 Apr 2023 11 Apr '23
11:23 a.m.
    while (rename(src, dest) < 0 && count < 2) {
            if (errno != EEXIST) {

rename can never return EEXIST in errno. maildir-save.c, line 124.

    /* move the file into new/ directory - syncing will pick it
       up from there */
    if (rename(tmp_path, new_path) == 0)
            failed = FALSE;

Here you can lose emails if the new/ folder contains a message whose base name is equal. The only way to avoid this is:

  1. use link and unlink, not rename
  2. leave messages that have a time_t part equal to or higher than time(NULL).

Anyway, Maildir has a strict consistency criteria which says that all messages that are linked from tmp/ into new/ _must_ use time(NULL) plus a number that is guaranteed not to lapse within one second, and which does not collide with other messages in new/. new/ is the single entry point into cur/, and messages in new/ can not be "older" than the messages in cur/.

The simple reasoning for this is that you can never guarantee that there is no message in cur/ that has the same base name, but perhaps different flags. It follows that when moving a message from new/ to cur/, it is required that the server only picks messages that are older than one second.

Andy

-- Andreas Aardal Hanssen http://www.andreas.hanssen.name/gpg

0 0
Reply
Sign in to reply online Use email software

Back to the thread

Back to the list

HyperKitty Powered by HyperKitty version 1.3.12.