From e53a81335266c30604db7e30d638db57d17457b3 Mon Sep 17 00:00:00 2001 From: Chad MILLER Date: Mon, 16 Mar 2009 14:54:28 -0400 Subject: [PATCH 1/5] Bug#39326: mysqld_safe doesn't use --basedir value in search of \ my_print_defaults Now use basedir to set an unset ledir and to find the location of my_print_defaults . --- scripts/mysqld_safe.sh | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index 5e7a177a546..502c981c72a 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -212,15 +212,26 @@ fi MY_PWD=`pwd` # Check for the directories we would expect from a binary release install -if test -f "$relpkgdata"/english/errmsg.sys -a -x ./bin/mysqld +if test -n "$MY_BASEDIR_VERSION" -a -d "$MY_BASEDIR_VERSION" then - MY_BASEDIR_VERSION=$MY_PWD # Where bin, share and data are - ledir=$MY_BASEDIR_VERSION/bin # Where mysqld is + # BASEDIR is already overridden on command line. Do not re-set. + + # Use BASEDIR to discover le. + if test -x "$MY_BASEDIR_VERSION/libexec/mysqld" + then + ledir="$MY_BASEDIR_VERSION/libexec" + else + ledir="$MY_BASEDIR_VERSION/bin" + fi +elif test -f "$relpkgdata"/english/errmsg.sys -a -x "$MY_PWD/bin/mysqld" +then + MY_BASEDIR_VERSION="$MY_PWD" # Where bin, share and data are + ledir="$MY_PWD/bin" # Where mysqld is # Check for the directories we would expect from a source install -elif test -f "$relpkgdata"/english/errmsg.sys -a -x ./libexec/mysqld +elif test -f "$relpkgdata"/english/errmsg.sys -a -x "$MY_PWD/libexec/mysqld" then - MY_BASEDIR_VERSION=$MY_PWD # Where libexec, share and var are - ledir=$MY_BASEDIR_VERSION/libexec # Where mysqld is + MY_BASEDIR_VERSION="$MY_PWD" # Where libexec, share and var are + ledir="$MY_PWD/libexec" # Where mysqld is # Since we didn't find anything, used the compiled-in defaults else MY_BASEDIR_VERSION=@prefix@ @@ -274,7 +285,10 @@ export MYSQL_HOME # Get first arguments from the my.cnf file, groups [mysqld] and [mysqld_safe] # and then merge with the command line arguments -if test -x ./bin/my_print_defaults +if test -x "$MY_BASEDIR_VERSION/bin/my_print_defaults" +then + print_defaults="$MY_BASEDIR_VERSION/bin/my_print_defaults" +elif test -x ./bin/my_print_defaults then print_defaults="./bin/my_print_defaults" elif test -x @bindir@/my_print_defaults From e7ed43065afc0c40a0c6dfcf98710e05c6645128 Mon Sep 17 00:00:00 2001 From: Chad MILLER Date: Mon, 16 Mar 2009 15:28:06 -0400 Subject: [PATCH 2/5] Fix several quoting problems, and clean up IFS on failure in my_which(). --- scripts/mysqld_safe.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index 502c981c72a..960c3e39bab 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -18,7 +18,7 @@ niceness=0 logging=init want_syslog=0 syslog_tag= -user=@MYSQLD_USER@ +user='@MYSQLD_USER@' pid_file= err_log= @@ -64,9 +64,10 @@ my_which () { save_ifs="${IFS-UNSET}" IFS=: + ret=0 for file do - for dir in $PATH + for dir in "$PATH" do if [ -f "$dir/$file" ] then @@ -74,15 +75,18 @@ my_which () continue 2 fi done - return 1 # Failure, didn't find file in path + + ret=1 #signal an error + break done + if [ "$save_ifs" = UNSET ] then unset IFS else IFS="$save_ifs" fi - return 0 # Success + return $ret # Success } log_generic () { @@ -234,8 +238,8 @@ then ledir="$MY_PWD/libexec" # Where mysqld is # Since we didn't find anything, used the compiled-in defaults else - MY_BASEDIR_VERSION=@prefix@ - ledir=@libexecdir@ + MY_BASEDIR_VERSION='@prefix@' + ledir='@libexecdir@' fi @@ -413,7 +417,7 @@ then MYSQLD=mysqld fi -if test ! -x $ledir/$MYSQLD +if test ! -x "$ledir/$MYSQLD" then log_error "The file $ledir/$MYSQLD does not exist or is not executable. Please cd to the mysql installation @@ -425,7 +429,7 @@ fi if test -z "$pid_file" then - pid_file=$DATADIR/`@HOSTNAME@`.pid + pid_file="$DATADIR/`@HOSTNAME@`.pid" else case "$pid_file" in /* ) ;; From 926c530c7d974ba459fb4da8791abc525b93f78c Mon Sep 17 00:00:00 2001 From: Chad MILLER Date: Tue, 17 Mar 2009 15:31:07 -0400 Subject: [PATCH 3/5] Bug#42675: Dangling pointer leads to a client crash (mysys/my_error.c \ patch enclosed) One call to my_error_unregister_all() would free pointers, but leave one pointer to just-freed memory still assigned. That's the bug. Subsequent calls of this function would try to follow pointers into deallocated, garbage memory and almost certainly SEGV. Now, after freeing a linked list, unset the initial pointer. --- mysys/my_error.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/mysys/my_error.c b/mysys/my_error.c index 07656dda979..06f2ef6ba0f 100644 --- a/mysys/my_error.c +++ b/mysys/my_error.c @@ -252,11 +252,16 @@ const char **my_error_unregister(int first, int last) void my_error_unregister_all(void) { - struct my_err_head *list, *next; - for (list= my_errmsgs_globerrs.meh_next; list; list= next) + struct my_err_head *cursor, *saved_next; + + for (cursor= my_errmsgs_globerrs.meh_next; cursor != NULL; cursor= saved_next) { - next= list->meh_next; - my_free((uchar*) list, MYF(0)); + /* We need this ptr, but we're about to free its container, so save it. */ + saved_next= cursor->meh_next; + + my_free((uchar*) cursor, MYF(0)); } + my_errmsgs_globerrs.meh_next= NULL; /* Freed in first iteration above. */ + my_errmsgs_list= &my_errmsgs_globerrs; } From 2443683f500c03e664f5a796056a89ee8de11e66 Mon Sep 17 00:00:00 2001 From: Chad MILLER Date: Tue, 17 Mar 2009 15:43:00 -0400 Subject: [PATCH 4/5] Fix indentation. tab -> spaces --- mysys/my_error.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysys/my_error.c b/mysys/my_error.c index 06f2ef6ba0f..2cf704d0089 100644 --- a/mysys/my_error.c +++ b/mysys/my_error.c @@ -256,7 +256,7 @@ void my_error_unregister_all(void) for (cursor= my_errmsgs_globerrs.meh_next; cursor != NULL; cursor= saved_next) { - /* We need this ptr, but we're about to free its container, so save it. */ + /* We need this ptr, but we're about to free its container, so save it. */ saved_next= cursor->meh_next; my_free((uchar*) cursor, MYF(0)); From ea24cef9b26318d54d747077515584307a3e127f Mon Sep 17 00:00:00 2001 From: Horst Hunger Date: Wed, 18 Mar 2009 17:23:39 +0100 Subject: [PATCH 5/5] Due to bug#43733 I disabled "concurrent_innodb_(un)safelog.test" for embedded server. --- mysql-test/include/concurrent.inc | 2 ++ mysql-test/t/disabled.def | 2 ++ 2 files changed, 4 insertions(+) diff --git a/mysql-test/include/concurrent.inc b/mysql-test/include/concurrent.inc index fe670cef08e..2180ec4cc9c 100644 --- a/mysql-test/include/concurrent.inc +++ b/mysql-test/include/concurrent.inc @@ -25,6 +25,8 @@ # new wrapper t/concurrent_innodb_safelog.test # +--source include/not_embedded.inc + connection default; # # Show prerequisites for this test. diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 3f61176e37b..eab0542314a 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -11,3 +11,5 @@ ############################################################################## kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild. innodb_bug39438 : BUG#42383 2009-01-28 lsoares "This fails in embedded and on windows. Note that this test is not run on windows and on embedded in PB for main trees currently" +#concurrent_innodb_safelog: disabled for embedded server due to bug#43733 Select on processlist let the embedded server crash (concurrent_innodb_safelog). +#concurrent_innodb_unsafelog: disabled for embedded server due to bug#43733.