Depending of the client, the bug could appear every day.

The observation
1. mbox is corrupted, first line (or more) is overwritten as
0000000 027 003 001 000 150 142 072 157 235 351 341 361 302 024 322 264
027 003 001 \0 h b : o 235 é á ñ Â 024 Ò ´

2/ there is always such message in mail.info
   /usr/sbin/mlock[XXXX]: (64) fd not regular file
and then
   imapd[29107]: Killed (lost mailbox lock) user=

My conclusions

1/ mlock is not OK (/usr/sbin/mlock)

2/ this code seems not ok in src/osdep/unix

   int unix_lock (char *file,int flags,int mode,DOTLOCK *lock,int op)
{
 int fd;
blocknotify_t bn = (blocknotify_t) mail_parameters (NIL,GET_BLOCKNOTIFY,NIL);
 (*bn) (BLOCK_FILELOCK,NIL);
                               /* try locking the easy way */
 if (dotlock_lock (file,lock,-1)) {
                               /* got dotlock file, easy open */
   if ((fd = open (file,flags,mode)) >= 0) flock (fd,op);
   else dotlock_unlock (lock); /* open failed, free the dotlock */
 }
                               /* no dot lock file, open file now */
 else if ((fd = open (file,flags,mode)) >= 0) {
/* try paranoid way to make a dot lock file */
   if (dotlock_lock (file,lock,fd)) {
     close (fd);               /* get fresh fd in case of timing race */
     if ((fd = open (file,flags,mode)) >= 0) flock (fd,op);
                               /* open failed, free the dotlock */
     else dotlock_unlock (lock);
   }
   else flock (fd,op);         /* paranoid way failed, just flock() it */
 }
 (*bn) (BLOCK_NONE,NIL);
 return fd;
}

dotlock_lock (file,lock,fd) fails because fd not a regular file. It could potentially fails for other reasons but never in my server. So my proposal would be :
   else {
       close (fd);
       fd = -1;
   }

Any comment would be appreciated (except to use dovecot).

Michel



--
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to