diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Makefile.am | 2 | ||||
-rw-r--r-- | scripts/mysqld_multi.sh | 58 | ||||
-rw-r--r-- | scripts/mysqld_safe.sh | 2 |
3 files changed, 50 insertions, 12 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 82a4fc2ca92..b2fef9acadf 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -135,7 +135,7 @@ SUFFIXES = .sh -e 's!@''MYSQLD_DEFAULT_SWITCHES''@!@MYSQLD_DEFAULT_SWITCHES@!' \ -e 's!@''MYSQL_UNIX_ADDR''@!@MYSQL_UNIX_ADDR@!' \ -e 's!@''MYSQL_TCP_PORT''@!@MYSQL_TCP_PORT@!' \ - -e 's!@''IS_LINUX''@!@IS_LINUX@!' \ + -e 's!@''TARGET_LINUX''@!@TARGET_LINUX@!' \ -e "s!@""CONF_COMMAND""@!@CONF_COMMAND@!" \ -e 's!@''MYSQLD_USER''@!@MYSQLD_USER@!' \ -e 's!@''STATIC_NSS_FLAGS''@!@STATIC_NSS_FLAGS@!' \ diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh index ee873a86c8d..642772bca44 100644 --- a/scripts/mysqld_multi.sh +++ b/scripts/mysqld_multi.sh @@ -4,7 +4,7 @@ use Getopt::Long; use POSIX qw(strftime); $|=1; -$VER="2.12"; +$VER="2.14"; $opt_config_file = undef(); $opt_example = 0; @@ -37,13 +37,13 @@ main(); sub main { - my ($flag_exit); + my $flag_exit= 0; if (!defined(my_which(my_print_defaults))) { # We can't throw out yet, since --version, --help, or --example may # have been given - print "WARNING! my_print_defaults command not found!\n"; + print "WARNING: my_print_defaults command not found.\n"; print "Please make sure you have this command available and\n"; print "in your path. The command is available from the latest\n"; print "MySQL distribution.\n"; @@ -66,6 +66,11 @@ sub main else { $opt_config_file= $1; + if (!($opt_config_file =~ m/\//)) + { + # No path. Use current working directory + $opt_config_file= "./" . $opt_config_file; + } } } } @@ -76,10 +81,18 @@ sub main chop @defops; splice @ARGV, 0, 0, @defops; } - GetOptions("help","example","version","mysqld=s","mysqladmin=s", - "config-file=s","user=s","password=s","log=s","no-log","tcp-ip", - "silent","verbose") - || die "Wrong option! See $my_progname --help for detailed information!\n"; + if (!GetOptions("help","example","version","mysqld=s","mysqladmin=s", + "config-file=s","user=s","password=s","log=s","no-log", + "tcp-ip", "silent","verbose")) + { + $flag_exit= 1; + } + if (defined($opt_config_file) && !($opt_config_file =~ m/\//)) + { + # No path. Use current working directory + $opt_config_file= "./" . $opt_config_file; + } + usage() if ($opt_help); if ($opt_verbose && $opt_silent) { @@ -95,15 +108,14 @@ sub main exit(0); } example() if ($opt_example); - usage() if ($opt_help); if ($flag_exit) { - print "Error with an option, see $my_progname --help for more info!\n"; + print "Error with an option, see $my_progname --help for more info.\n"; exit(1); } if (!defined(my_which(my_print_defaults))) { - print "ABORT: Can't find command 'my_print_defaults'!\n"; + print "ABORT: Can't find command 'my_print_defaults'.\n"; print "This command is available from the latest MySQL\n"; print "distribution. Please make sure you have the command\n"; print "in your PATH.\n"; @@ -157,6 +169,31 @@ sub main } #### +#### Quote option argument. Add double quotes around the argument +#### and escape the following: $, \, " +#### This function is needed, because my_print_defaults drops possible +#### quotes, single or double, from in front of an argument and from +#### the end. +#### + +sub quote_opt_arg +{ + my ($option)= @_; + + if ($option =~ m/(\-\-[a-zA-Z0-9\_\-]+)=(.*)/) + { + $option= $1; + $arg= $2; + $arg=~ s/\\/\\\\/g; # Escape escape character first to avoid doubling. + $arg=~ s/\$/\\\$/g; + $arg=~ s/\"/\\\"/g; + $arg= "\"" . $arg . "\""; + $option= $option . "=" . $arg; + } + return $option; +} + +#### #### Init log file. Check for appropriate place for log file, in the following #### order my_print_defaults mysqld datadir, @datadir@, /var/log, /tmp #### @@ -290,6 +327,7 @@ sub start_mysqlds() else { $options[$j]=~ s/;/\\;/g; + $options[$j]= quote_opt_arg($options[$j]); $tmp.= " $options[$j]"; } } diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index 10983d2850f..9ec573737bd 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -368,7 +368,7 @@ do break fi - if @IS_LINUX@ && test $KILL_MYSQLD -eq 1 + if @TARGET_LINUX@ && test $KILL_MYSQLD -eq 1 then # Test if one process was hanging. # This is only a fix for Linux (running as base 3 mysqld processes) |