Subject: pkg/36138: mysqld rc script not creating databases if on a mount point
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <ef@math.uni-bonn.de>
List: pkgsrc-bugs
Date: 04/11/2007 15:00:00
>Number:         36138
>Category:       pkg
>Synopsis:       mysqld rc script not creating databases if on a mount point
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 11 15:00:00 +0000 2007
>Originator:     Edgar Fuß
>Release:        2006Q4
>Organization:
Mathematisches Institut der Universität Bonn, Computerabteilung
>Environment:
>Description:
	If /var/mysql (or, more generally, mysql_datadir) is a mount point,
	the mysqld rc.d script will fail to notice it has to create the
	initial system databases.
	This is because checks existance of the directory itself, which,
	of course, had to be created if it's a mount point.
	It would better check for the mysql databse inside the directory.
>How-To-Repeat:
	pkg_add mysql-server
	cp /usr/pkg/share/examples/rc.d/mysqld /etc/rc.d/
	mkdir /var/mysql
	mount /dev/xxx /var/mysql # not strictly neccessary
	/etc/rc.d/mysqld start
>Fix:
	In the rc script (function mysqld_precmd()), change
		if [ ! -d ${mysqld_datadir} ]; then
	to
		if [ ! -d ${mysqld_datadir}/mysql ]; then