Subject: misc/33760: a default install can't send mail due to missing aliases.db
To: None <misc-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <dieter.NetBSD@pandora.be>
List: netbsd-bugs
Date: 06/18/2006 13:55:00
>Number:         33760
>Category:       misc
>Synopsis:       a default install can't send mail due to missing aliases.db
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    misc-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jun 18 13:55:00 +0000 2006
>Originator:     dieter roelants
>Release:        NetBSD 3.99.21
>Organization:
not during the weekend
>Environment:
System: NetBSD simult.amelgem.be 3.99.21 NetBSD 3.99.21 (GENERIC.MPACPI) #1: Sun Jun 18 00:46:53 UTC 2006 root@simult.amelgem.be:/build/obj-i386/sys/arch/i386/compile/GENERIC.MPACPI i386
Architecture: i386
Machine: i386
>Description:
	A freshly installed NetBSD -current system isn't able to deliver mail. Instead it starts filling the maillog like this:
	postfix/local[6595]: fatal: open database /etc/mail/aliases.db: No such file or directory
	postfix/master[764]: warning: process /usr/libexec/postfix/local pid 6595 exit status 1
	postfix/master[764]: warning: /usr/libexec/postfix/local: bad command startup -- throttling
	[ repeated over and over ]
	And indeed there's /etc/mail/aliases, but not the hash file.
>How-To-Repeat:
	Install a -current NetBSD. Try to send a mail through local
	postfix or wait for the nightly checks.
>Fix:
	I suggest taking over the checks for aliases.db from the
	now gone sendmail rc.d script:

--- postfix	18 Jun 2006 12:27:34 -0000	1.1
+++ postfix	18 Jun 2006 14:32:34 -0000	1.2
@@ -36,6 +36,19 @@
 			    cp -p /etc/$f ${spooletcdir}/$f
 		fi
 	done
+
+	# check modifications on /etc/mail/aliases
+	if [ -f "/etc/mail/aliases.db" ]; then
+		if [ ! "/etc/mail/aliases" -ot "/etc/mail/aliases.db" ]; then
+			echo \
+	    "${name}: /etc/mail/aliases newer than /etc/mail/aliases.db, regenerating"
+			/usr/bin/newaliases
+		fi
+	else
+		echo \
+	    "${name}: /etc/mail/aliases.db not present, generating"
+			/usr/bin/newaliases
+	fi
 }
 
 postfix_op()