Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 6 Mar 1999 15:16:53 -0800 (PST)
From:      dhesi@rahul.net
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/10444: enhancement: avoid lost mail when mail filesystem is not mounted
Message-ID:  <199903062316.PAA13210@blue.rahul.net>

next in thread | raw e-mail | index | archive | help

>Number:         10444
>Category:       bin
>Synopsis:       avoiding lost mail when mail filesystem is not mounted
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Mar  6 15:20:01 PST 1999
>Closed-Date:
>Last-Modified:
>Originator:     Rahul Dhesi
>Release:        FreeBSD 2.2.8-19990120-SNAP i386
>Organization:
a2i network
>Environment:

	not relevant, aplies to all versions of all UNIXes

>Description:

	Consider the situation when for some reason the filesystem
	that holds incoming mailboxes is not mounted.  This can
	happen (a) in the case of a disk problem or (b) if the
	filesystem comes from a remote NFS server and that server
	was down when our machine rebooted.  But suppose the normal
	mount point of the filesystem is an empty directory with
	the same pathname as the intended pathname of the mail
	filesystem.  E.g., let /var/mail exist but let it be the
	mount point where the filesystem will actually be mounted.

	Mail delivery programs are not normally prepared to deal
	with this situation.  Incoming mail arrives for a user u
	and gets delivered into /var/mail/u .  When the filesystem
	finally gets mounted over /var/mail, the file /var/mail/u
	is now invisible, and user u has effectively lost the
	incoming message.  He won't see it until the next time that
	the mail filesystem remains unmounted.

	I have classified this PR as 'non-critical', but in fact
	in certain environments this problem can be very serious.
	The silent loss of incoming mail is always a serious problem.

>How-To-Repeat:

	1. Arrange to have the filesystem that will hold incoming mail
	   be not mounted, but let /var/mail be an empty directory.
	2. Send mail to any local user.
	3. Mount the /var/mail filesystem.
	4. Ask the user to look for his incoming mail.

>Fix:
	
	I have been the following solution for many years.  The
	local mailer looks for a file called '.MAIL.FSYS' in the
	mail filesystem.  If it exists, mail delivery occurs as
	usual.  If it does not exist, the mailer exits with a
	temporary failure, and mail remains queued.

	I propose that FreeBSD adopt this convention, and that by
	default mail.local check for the existence of '.MAIL.FSYS'
	as above.  Also all FreeBSD ports for all programs that do
	mail delivery, such as procmail, should do the same check.

	And this convention should be documented, thus encouraging
	all all authors of mail programs that do mail delivery to
	incoporate this check into their software.

	The C code given below may be inserted almost anywhere,
	the only variable part being the directory path.

	{
	   struct stat statbuf;
	#define MARKER  "/var/mail/.MAIL.FSYS"
	   if (stat(MARKER, &statbuf) != 0) {
	      /* not mounted, exit with temp error */
	      exit(75);
	   }
	}

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199903062316.PAA13210>