From rdroot@blue.rahul.net Sat Mar 6 15:17:14 1999 Return-Path: Received: from free.rahul.net (free.rahul.net [192.160.13.11]) by hub.freebsd.org (Postfix) with SMTP id AC9D514C30 for ; Sat, 6 Mar 1999 15:17:12 -0800 (PST) (envelope-from rdroot@blue.rahul.net) Received: from blue.rahul.net [192.160.13.20] by free.rahul.net with esmtp (Exim 1.71 #13) id 10JQJR-0001p2-00; Sat, 6 Mar 1999 15:16:53 -0800 Received: (from root@localhost) by blue.rahul.net (8.8.8/8.8.8) id PAA13210; Sat, 6 Mar 1999 15:16:53 -0800 (PST) (envelope-from rdroot) Message-Id: <199903062316.PAA13210@blue.rahul.net> Date: Sat, 6 Mar 1999 15:16:53 -0800 (PST) From: dhesi@rahul.net Sender: rdroot@blue.rahul.net Reply-To: dhesi@rahul.net To: FreeBSD-gnats-submit@freebsd.org Subject: enhancement: avoid lost mail when mail filesystem is not mounted X-Send-Pr-Version: 3.2 >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: closed >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sat Mar 6 15:20:01 PST 1999 >Closed-Date: Sat Jun 16 04:33:53 PDT 2001 >Last-Modified: Sat Jun 16 04:36:42 PDT 2001 >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: From: Chris Costello To: dhesi@rahul.net Cc: FreeBSD-gnats-submit@FreeBSD.ORG Subject: Re: bin/10444: enhancement: avoid lost mail when mail filesystem is not mounted Date: Sat, 6 Mar 1999 19:40:16 -0600 On Sat, Mar 6, 1999, dhesi@rahul.net put this into my mailbox: [...] > 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. Well, in FreeBSD, /var/mail is not usually its own partition, and /var is. Sendmail (default MTA shipped with FreeBSD) uses /var/spool/mqueue as its queue directory, so if /var is not mounted, Sendmail would not be able to queue mail in the first place. -Chris -- Powered by FreeBSD 4.0-CURRENT. "The Power to Serve!" Emacs is a nice operating system, but I prefer UNIX. - Tom Christiansen State-Changed-From-To: open->closed State-Changed-By: schweikh State-Changed-When: Sat Jun 16 04:33:53 PDT 2001 State-Changed-Why: The proposed solution of having all MTAs looking for some files is certainly out of the question. There's an easy and viable workaround as Chris proposed: don't have user's mailboxen in the directory of the mountpoint but at least one directory below. http://www.FreeBSD.org/cgi/query-pr.cgi?pr=10444 >Unformatted: