Subject: pkg/31435: mysqld rc.d file is broken
To: None <,,>
From: None <>
List: pkgsrc-bugs
Date: 10/01/2005 05:06:00
>Number:         31435
>Category:       pkg
>Synopsis:       mysqld's rc.d script doesn't honor rc.conf settings
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 01 05:06:00 +0000 2005
>Originator:     David A. Holland <>
>Release:        NetBSD 2.0.2
   Harvard EECS
System: NetBSD whinery 2.0.2 NetBSD 2.0.2 (GENERIC) #0: Wed Mar 23 08:53:42 UTC 2005 i386
Architecture: i386
Machine: i386
	The rc.d script that the mysql-server package installs in
	/usr/pkg/share/examples/rc.d says at the top that you can
	set the variables "mysqld_user" and "mysqld_datadir" from
	rc.conf, but it in fact ignores any such settings.

	This makes the script less than thoroughly useful.

	Worse, since the script automatically sets up the default
	database directory if it's not there, if you set things up
	manually somewhere else and then reboot partway through
	an install of some application, you can end up with some
	things in one directory and some things in another and
	generally a horrible mess.

	A naive user might also set mysqld_datadir to someplace where
	it would be backed up and not even notice that the database
	was actually appearing in /var.

	Ignoring mysqld_user (and mysqld_group, which isn't documented
	in the comment but ought to behave the same) can cause other
	annoying problems.

	Set mysqld_datadir='/home/mysql' (or whatever) in /etc/rc.conf,
	set mysqld=YES, run /etc/rc.d/mysql start, and watch it put the
	database in /var/mysql anyway.

	Something like this:

Index: databases/mysql-server/files/
RCS file: /cvsroot/pkgsrc/databases/mysql-server/files/,v
retrieving revision 1.3
diff -u -r1.3
--- databases/mysql-server/files/	28 Oct 2004 01:08:15 -0000	1.3
+++ databases/mysql-server/files/	1 Oct 2005 05:03:46 -0000
@@ -13,6 +13,7 @@
 # The following variables are optional:
 #       mysqld_user="mysql"		# user to run mysqld as
+#       mysqld_group="mysql"		# group to run mysqld as
 #       mysqld_datadir="/path/to/home"	# path to MySQL database directory
@@ -24,9 +25,9 @@
+: ${mysqld_user:="@MYSQL_USER@"}
+: ${mysqld_group:="@MYSQL_GROUP@"}
+: ${mysqld_datadir:="@MYSQL_DATADIR@"}