[Dovecot] Creating and renaming mbox folders on NFS auto-installed partitions

Robert Evans Robert.Evans at cs.cardiff.ac.uk
Wed May 14 18:37:42 EEST 2003


I'm trying dovecot-0.99.9.1 in place of uw-imap which ground to a halt
on a 500MHz SunBlade 100 Solaris 8 system which acts as our Departmental
mail server.  INBOXes are mbox files on the servers's local SCSI disk.
But user directories are auto mounted from other Sun NFS servers and
these may contain other mbox mailboxes in a ~/Mail directory.

There's a problem with creating (and with renaming) mailboxes in the NFS
mounted ~/Mail directory.  For an arbitrary mailbox "newbox", say,
dovecot tries to create the parent directory path /home/username/Mail
before creating the newbox file.

But /home/username is automounted and so creating directory /home or
/home/username fails with errno 89 ENOSYS - unsupported file system
operation. 

The solution is to check for the existence of the directory before
trying to create it.  This will work since /home and /home/username will
always exist for any valid user.

I've amended mbox-storage.c in src/lib-storage/index/mbox to call
"access" to do this....

*** src/lib-storage/index/mbox/mbox-storage.c.orig	Tue Apr 15 14:04:02 2003
--- src/lib-storage/index/mbox/mbox-storage.c	Wed May 14 16:04:39 2003
***************
*** 38,44 ****
  			p++;
  		}
  
! 		if (mkdir(dir, CREATE_MODE) < 0 && errno != EEXIST) {
  			t_pop();
  			return -1;
  		}
--- 38,44 ----
  			p++;
  		}
  
! 		if ( (access(dir,F_OK) != 0) && mkdir(dir, CREATE_MODE) < 0 && errno != EEXIST) {
  			t_pop();
  			return -1;
  		}

- - -
(Could also remove the && errno == EEXIST part - it's redundant 
when access(dir,F_OK) is checking for existence).

Robert
-- 
Robert.Evans at cs.cf.ac.uk Tel:+44(0)29 2087 5518 Fax:+44(0)29 2087 4598
http://www.cs.cf.ac.uk/department/staff/Robert.Evans.shtml
Computer Science, Cardiff University, PO Box 916, Cardiff, CF24 3XF, UK




More information about the dovecot mailing list