nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] Truncated Email.

2016-03-06 07:20:38
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 != 
st.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.

_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>