From 84c5ba6ece069ec8874c0efec44cd2bd425bc534 Mon Sep 17 00:00:00 2001 From: Jim Winstead Date: Tue, 5 May 2009 11:07:26 -0700 Subject: [PATCH 1/7] Fix incorrect filename in verbose output of innochecksum. (Bug #44484, patch contributed by Andrew Hutchings) --- extra/innochecksum.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/innochecksum.c b/extra/innochecksum.c index 524637a1729..9bd4bfcc0cd 100644 --- a/extra/innochecksum.c +++ b/extra/innochecksum.c @@ -224,7 +224,7 @@ int main(int argc, char **argv) } else if (verbose) { - printf("file %s= %llu bytes (%lu pages)...\n", argv[1], size, pages); + printf("file %s = %llu bytes (%lu pages)...\n", argv[optind], size, pages); printf("checking pages in range %lu to %lu\n", start_page, use_end_page ? end_page : (pages - 1)); } From b78f9a8659adf3be4ecbad3db59a97deff4f2193 Mon Sep 17 00:00:00 2001 From: Jim Winstead Date: Thu, 7 May 2009 10:40:00 -0700 Subject: [PATCH 2/7] =?UTF-8?q?Add=20explanation=20of=20the=20possible=20-?= =?UTF-8?q?s=20values=20for=20mysqldumpslow.=20(Bug=20#35663,=20based=20on?= =?UTF-8?q?=20a=20contribution=20by=20Ask=20Bj=C3=B8rn=20Hansen)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/mysqldumpslow.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/mysqldumpslow.sh b/scripts/mysqldumpslow.sh index 1e942b035cb..8580b8e6203 100644 --- a/scripts/mysqldumpslow.sh +++ b/scripts/mysqldumpslow.sh @@ -163,7 +163,14 @@ Parse and summarize the MySQL slow query log. Options are -v verbose -d debug - -s ORDER what to sort by (al, at, ar, c, t, l, r), 'at' is default + -s ORDER what to sort by (al, at, ar, c, l, r, t), 'at' is default + al: average lock time + ar: average rows sent + at: average query time + c: count + l: lock time + r: rows sent + t: query time -r reverse the sort order (largest last instead of first) -t NUM just show the top n queries -a don't abstract all numbers to N and strings to 'S' From 038be08a1b8f29479e6ff993328692d0875650c2 Mon Sep 17 00:00:00 2001 From: Jim Winstead Date: Thu, 7 May 2009 10:51:55 -0700 Subject: [PATCH 3/7] Various command-line utilities, including mysqlbinlog and mysqldump, don't handle the --skip-password option correctly. (Bug #28479) --- client/mysql_upgrade.c | 2 ++ client/mysqladmin.cc | 2 ++ client/mysqlbinlog.cc | 2 ++ client/mysqlcheck.c | 2 ++ client/mysqldump.c | 2 ++ client/mysqlimport.c | 2 ++ client/mysqlshow.c | 2 ++ client/mysqlslap.c | 2 ++ client/mysqltest.cc | 2 ++ 9 files changed, 18 insertions(+) diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index c50f7e03c27..cbc60d8acad 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -231,6 +231,8 @@ get_one_option(int optid, const struct my_option *opt, break; case 'p': + if (argument == disabled_my_option) + argument= (char*) ""; // Don't require password tty_password= 1; add_option= FALSE; if (argument) diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index df0dc1e7049..94d3d92e03a 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -232,6 +232,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), opt_count_iterations= 1; break; case 'p': + if (argument == disabled_my_option) + argument= (char*) ""; // Don't require password if (argument) { char *start=argument; diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 1621db5ded8..2c2023ae129 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -1226,6 +1226,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), one_database = 1; break; case 'p': + if (argument == disabled_my_option) + argument= (char*) ""; // Don't require password if (argument) { my_free(pass,MYF(MY_ALLOW_ZERO_PTR)); diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index d2edd084c57..1bdb28f5a11 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -286,6 +286,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), what_to_do= DO_UPGRADE; break; case 'p': + if (argument == disabled_my_option) + argument= (char*) ""; // Don't require password if (argument) { char *start = argument; diff --git a/client/mysqldump.c b/client/mysqldump.c index 44106388d69..323376dd8bf 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -702,6 +702,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), break; #endif case 'p': + if (argument == disabled_my_option) + argument= (char*) ""; // Don't require password if (argument) { char *start=argument; diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 09ba27b287a..ec418244f3d 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -221,6 +221,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), break; #endif case 'p': + if (argument == disabled_my_option) + argument= (char*) ""; // Don't require password if (argument) { char *start=argument; diff --git a/client/mysqlshow.c b/client/mysqlshow.c index 0e696aed211..e401d6cad8f 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -281,6 +281,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), opt_verbose++; break; case 'p': + if (argument == disabled_my_option) + argument= (char*) ""; // Don't require password if (argument) { char *start=argument; diff --git a/client/mysqlslap.c b/client/mysqlslap.c index b8515289df5..4cf8c7204ed 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -712,6 +712,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), verbose++; break; case 'p': + if (argument == disabled_my_option) + argument= (char*) ""; // Don't require password if (argument) { char *start= argument; diff --git a/client/mysqltest.cc b/client/mysqltest.cc index fb6baa744b2..f29fd36aa27 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -5803,6 +5803,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), break; } case 'p': + if (argument == disabled_my_option) + argument= (char*) ""; // Don't require password if (argument) { my_free(opt_pass, MYF(MY_ALLOW_ZERO_PTR)); From 9345dbba6fdb3ef21b72db03ce38ca832154c235 Mon Sep 17 00:00:00 2001 From: Jim Winstead Date: Thu, 7 May 2009 13:09:53 -0700 Subject: [PATCH 4/7] mysqladmin kill can't handle 64-bit thread IDs. (Bug #32457) --- client/mysqladmin.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index 94d3d92e03a..9865b67bb3b 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -679,10 +679,16 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) pos=argv[1]; for (;;) { - if (mysql_kill(mysql,(ulong) atol(pos))) + /* We don't use mysql_kill(), since it only handles 32-bit IDs. */ + char buff[26], *out; /* "KILL " + max 20 digs + NUL */ + out= strxmov(buff, "KILL ", NullS); + ullstr(strtoull(pos, NULL, 0), out); + + if (mysql_query(mysql, buff)) { - my_printf_error(0, "kill failed on %ld; error: '%s'", error_flags, - atol(pos), mysql_error(mysql)); + /* out still points to just the number */ + my_printf_error(0, "kill failed on %s; error: '%s'", error_flags, + out, mysql_error(mysql)); error=1; } if (!(pos=strchr(pos,','))) From cc3f48b2e19fae758dfef659ea277cd564bec4ca Mon Sep 17 00:00:00 2001 From: Jim Winstead Date: Thu, 7 May 2009 17:25:23 -0700 Subject: [PATCH 5/7] mysqld_safe could generate filenames with spaces and then didn't properly quote them in later use. (Bug #33685, based on a patch by Hartmut Holzgraefe) --- scripts/mysqld_safe.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index 960c3e39bab..34dc019a82a 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -391,8 +391,8 @@ then fi # Change the err log to the right user, if it is in use if [ $want_syslog -eq 0 ]; then - touch $err_log - chown $user $err_log + touch "$err_log" + chown $user "$err_log" fi if test -n "$open_files" then @@ -509,9 +509,9 @@ fi # # If there exists an old pid file, check if the daemon is already running # Note: The switches to 'ps' may depend on your operating system -if test -f $pid_file +if test -f "$pid_file" then - PID=`cat $pid_file` + PID=`cat "$pid_file"` if @CHECK_PID@ then if @FIND_PROC@ @@ -520,8 +520,8 @@ then exit 1 fi fi - rm -f $pid_file - if test -f $pid_file + rm -f "$pid_file" + if test -f "$pid_file" then log_error "Fatal error: Can't remove the pid file: $pid_file @@ -563,11 +563,11 @@ test -n "$NOHUP_NICENESS" && cmd="$cmd < /dev/null" log_notice "Starting $MYSQLD daemon with databases from $DATADIR" while true do - rm -f $safe_mysql_unix_port $pid_file # Some extra safety + rm -f $safe_mysql_unix_port "$pid_file" # Some extra safety eval_log_error "$cmd" - if test ! -f $pid_file # This is removed if normal shutdown + if test ! -f "$pid_file" # This is removed if normal shutdown then break fi From 464252a25b87706a1c36306e1e4d13f738a5f71a Mon Sep 17 00:00:00 2001 From: Jim Winstead Date: Thu, 7 May 2009 17:48:20 -0700 Subject: [PATCH 6/7] The mysql command-line client did not properly handle MYSQL_HISTFILE being set to an empty string, or to /dev/null, as we suggest and have suggested in the documentation. (Bug #34224) --- client/mysql.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/client/mysql.cc b/client/mysql.cc index d29bd8571c9..8de3cfee041 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1183,7 +1183,12 @@ int main(int argc,char *argv[]) histfile= 0; } } - if (histfile) + + /* We used to suggest setting MYSQL_HISTFILE=/dev/null. */ + if (histfile && strncmp(histfile, "/dev/null", 10) == 0) + histfile= NULL; + + if (histfile && histfile[0]) { if (verbose) tee_fprintf(stdout, "Reading history-file %s\n",histfile); @@ -1218,7 +1223,8 @@ sig_handler mysql_end(int sig) { mysql_close(&mysql); #ifdef HAVE_READLINE - if (!status.batch && !quick && !opt_html && !opt_xml && histfile) + if (!status.batch && !quick && !opt_html && !opt_xml && + histfile && histfile[0]) { /* write-history */ if (verbose) From d0a1de80b41efa3cc5b58420905c721356eb6a52 Mon Sep 17 00:00:00 2001 From: Jim Winstead Date: Thu, 7 May 2009 17:53:03 -0700 Subject: [PATCH 7/7] The arguments to use for ps on Mac OS X were mis-detected by the mysql_zap utility. (Bug #41883, patch by Nicklas Westerlund) --- scripts/mysql_zap.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/mysql_zap.sh b/scripts/mysql_zap.sh index 6c05afb772c..3bb92aaec2e 100644 --- a/scripts/mysql_zap.sh +++ b/scripts/mysql_zap.sh @@ -27,8 +27,8 @@ $opt_f= 0; $opt_t= 0; $opt_a = ""; -$BSD = -f '/vmunix' || $ENV{"OS"} eq "SunOS4" || $^O eq 'darwin'; -$LINUX = $^O eq 'linux'; +$BSD = -f '/vmunix' || $ENV{"OS"} eq "SunOS4"; +$LINUX = $^O eq 'linux' || $^O eq 'darwin'; $pscmd = $BSD ? "/bin/ps -auxww" : $LINUX ? "/bin/ps axuw" : "/bin/ps -ef"; open(TTYIN, "