pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/31435: mysqld rc.d file is broken



>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 <dholland%eecs.harvard.edu@localhost>
>Release:        NetBSD 2.0.2
>Organization:
   Harvard EECS
>Environment:
System: NetBSD whinery 2.0.2 NetBSD 2.0.2 (GENERIC) #0: Wed Mar 23 08:53:42 UTC 
2005  
jmc%faith.netbsd.org@localhost:/home/builds/ab/netbsd-2-0-2-RELEASE/i386/200503220140Z-obj/home/builds/ab/netbsd-2-0-2-RELEASE/src/sys/arch/i36/compile/GENERIC
 i386
Architecture: i386
Machine: i386
>Description:
        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.

>How-To-Repeat:
        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.

>Fix:
        Something like this:

Index: databases/mysql-server/files/mysqld.sh
===================================================================
RCS file: /cvsroot/pkgsrc/databases/mysql-server/files/mysqld.sh,v
retrieving revision 1.3
diff -u -r1.3 mysqld.sh
--- databases/mysql-server/files/mysqld.sh      28 Oct 2004 01:08:15 -0000      
1.3
+++ databases/mysql-server/files/mysqld.sh      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 @@
 rcvar=${name}
 command="@PREFIX@/bin/mysqld_safe"
 procname="@PREFIX@/libexec/${name}"
-mysqld_user="@MYSQL_USER@"
-mysqld_group="@MYSQL_GROUP@"
-mysqld_datadir="@MYSQL_DATADIR@"
+: ${mysqld_user:="@MYSQL_USER@"}
+: ${mysqld_group:="@MYSQL_GROUP@"}
+: ${mysqld_datadir:="@MYSQL_DATADIR@"}
 pidfile="${mysqld_datadir}/`@HOSTNAME_CMD@`.pid"
 
 extra_commands="initdb"




Home | Main Index | Thread Index | Old Index