[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nmh-workers] Truncated Email.

From: Ralph Corderoy
Subject: Re: [Nmh-workers] Truncated Email.
Date: Sun, 06 Mar 2016 13:20:09 +0000

I wrote:
> So this should stop happening when I fix the locking?  Is that true?

strace(8) shows inc is using fcntl(2)'s F_SETLK, and,

    $ postconf mailbox_delivery_lock
    mailbox_delivery_lock = fcntl, dotlock

`strace postlock /var/mail/ralph true' shows Postfix is doing the same,
but with dotlock wrapped around it as braces.

So I'm puzzled why "new mail has arrived" appears.

Also, uip/inc.c has

   841      /*
   842       * truncate file we are incorporating from
   843       */
   844      if (inc_type == INC_FILE && Maildir == NULL) {
   845          if (trnflag) {
   846              if (stat (newmail, &st) != NOTOK && s1.st_mtime != 
   847                  advise (NULL, "new messages have arrived!\007");
   848              else {
   849                  int newfd;
   850                  if ((newfd = creat (newmail, 0600)) != NOTOK)
   851                      close (newfd);
   852                  else
   853                      admonish (newmail, "error zero'ing");
   854                  (void) m_unlink(map_name(newmail));
   855              }
   856          } else {
   857              if (noisy)
   858                  printf ("%s not zero'd\n", newmail);
   859          }
   860      }

851's close(2) is on the same file, newmail, /var/mail/ralph, as the
held fcntl lock, thus this releases the lock as they're tied to the
file, not the file descriptor, and all are released when any of the
process's file descriptors for that file are closed.

Cheers, Ralph.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]