List:Internals« Previous MessageNext Message »
From:Nicolas Baradakis Date:June 10 2005 5:12pm
Subject:Quoting problem in mysqld_multi
View as plain text  
I think there is a problem when mysqld_multi builds the command line
which starts or stops an instance of mysqld. If the value of an option
in my.cnf contains a metacharacter of the shell, weird things happen.
For example, a '>' or a '|' in a password raises errors.

Putting quotes around options in the command line should be a wise
thing to do in this case.

--- mysql-4.1.13-nightly-20050610.orig/scripts/mysqld_multi.sh	2005-06-10
16:29:48.000000000 +0200
+++ mysql-4.1.13-nightly-20050610/scripts/mysqld_multi.sh	2005-06-10 16:44:55.172526848
+0200
@@ -289,8 +289,7 @@
       }
       else
       {
-	$options[$j]=~ s/;/\\;/g;
-	$tmp.= " $options[$j]";
+	$tmp.= " \'$options[$j]\'";
       }
     }
     if ($opt_verbose && $com =~ m/\/safe_mysqld$/ && !$info_sent)
@@ -374,7 +373,7 @@
   $mysqladmin_found= 0 if (!length($mysqladmin));
   $com = "$mysqladmin";
   $tmp = " -u $opt_user";
-  $tmp.= defined($opt_password) ? " -p$opt_password" : "";
+  $tmp.= defined($opt_password) ? " -p\'$opt_password\'" : "";
   $tmp.= $opt_tcp_ip ? " -h 127.0.0.1" : "";
   for ($j = 0; defined($options[$j]); $j++)
   {


-- 
Nicolas Baradakis
Thread
Quoting problem in mysqld_multiNicolas Baradakis10 Jun