From ff58749b290dc8f5f8e78ce7b5a73d7efecc610a Mon Sep 17 00:00:00 2001 From: "jani@a88-113-38-195.elisa-laajakaista.fi" <> Date: Mon, 22 Jan 2007 02:32:07 +0200 Subject: [PATCH 01/11] Fix for configure to detect library correctly. Fix to check library in use during runtime. Fix for Bug#16995, "idle connections not being killed due to timeout when NPTL is used". --- BUILD/SETUP.sh | 4 +- configure.in | 161 ++++++++++++++++++++++++++----------------- include/my_global.h | 7 +- include/my_pthread.h | 41 ++++++++--- include/thr_alarm.h | 5 -- mysys/my_pthread.c | 4 +- mysys/thr_alarm.c | 93 +++++++++++-------------- sql/mysqld.cc | 53 +++++++++----- 8 files changed, 216 insertions(+), 152 deletions(-) diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh index 150f9e28b41..779d0f1c660 100644 --- a/BUILD/SETUP.sh +++ b/BUILD/SETUP.sh @@ -39,8 +39,8 @@ global_warnings="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wch c_warnings="$global_warnings -Wunused" cxx_warnings="$global_warnings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor" -alpha_cflags="-mcpu=ev6 -Wa,-mev6" # Not used yet -pentium_cflags="-mcpu=pentiumpro" +#alpha_cflags="-mcpu=ev6 -Wa,-mev6" # Not used yet +#pentium_cflags="-mcpu=pentiumpro" sparc_cflags="" # be as fast as we can be without losing our ability to backtrace diff --git a/configure.in b/configure.in index a59f1e30ab2..10f8ca37a4b 100644 --- a/configure.in +++ b/configure.in @@ -388,15 +388,16 @@ AC_MSG_CHECKING("if we should use 'skip-locking' as default for $target_os") if expr "$target_os" : "[[Ll]]inux.*" > /dev/null then MYSQLD_DEFAULT_SWITCHES="--skip-locking" - IS_LINUX="true" + TARGET_LINUX="true" AC_MSG_RESULT("yes"); + AC_DEFINE([TARGET_OS_LINUX], [1], [Whether we build for Linux]) else MYSQLD_DEFAULT_SWITCHES="" - IS_LINUX="false" + TARGET_LINUX="false" AC_MSG_RESULT("no"); fi AC_SUBST(MYSQLD_DEFAULT_SWITCHES) -AC_SUBST(IS_LINUX) +AC_SUBST(TARGET_LINUX) dnl Find paths to some shell programs AC_PATH_PROG(LN, ln, ln) @@ -576,7 +577,7 @@ AC_SUBST(NOINST_LDFLAGS) # (this is true on the MySQL build machines to avoid NSS problems) # -if test "$IS_LINUX" = "true" -a "$static_nss" = "" +if test "$TARGET_LINUX" = "true" -a "$static_nss" = "" then tmp=`nm /usr/lib/libc.a | grep _nss_files_getaliasent_r` if test -n "$tmp" @@ -827,7 +828,7 @@ struct request_info *req; ]) AC_SUBST(WRAPLIBS) -if test "$IS_LINUX" = "true"; then +if test "$TARGET_LINUX" = "true"; then AC_MSG_CHECKING([for atomic operations]) AC_LANG_SAVE @@ -870,7 +871,7 @@ int main() [ USE_PSTACK=no ]) pstack_libs= pstack_dirs= - if test "$USE_PSTACK" = yes -a "$IS_LINUX" = "true" -a "$BASE_MACHINE_TYPE" = "i386" -a "$with_mit_threads" = "no" + if test "$USE_PSTACK" = yes -a "$TARGET_LINUX" = "true" -a "$BASE_MACHINE_TYPE" = "i386" -a "$with_mit_threads" = "no" then have_libiberty= have_libbfd= my_save_LIBS="$LIBS" @@ -1239,63 +1240,98 @@ with_posix_threads="no" # Hack for DEC-UNIX (OSF1) if test "$with_named_thread" = "no" -a "$with_mit_threads" = "no" then - # Look for LinuxThreads. - AC_MSG_CHECKING("LinuxThreads") - grepres=`grep Linuxthreads /usr/include/pthread.h 2>/dev/null | wc -l` - getconfres=`which getconf >/dev/null && getconf GNU_LIBPTHREAD_VERSION | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ |grep LINUXTHREADS | wc -l || echo 0` - if test "$grepres" -gt 0 -o "$getconfres" -gt 0 + AC_MSG_CHECKING("Linux threads") + if test "$TARGET_LINUX" = "true" then - AC_MSG_RESULT("Found") - AC_DEFINE(HAVE_LINUXTHREADS) - # Linux 2.0 sanity check - AC_TRY_COMPILE([#include ], [int a = sched_get_priority_min(1);], , - AC_MSG_ERROR([Syntax error in sched.h. Change _P to __P in the /usr/include/sched.h file. See the Installation chapter in the Reference Manual])) - # RedHat 5.0 does not work with dynamic linking of this. -static also - # gives a speed increase in linux so it does not hurt on other systems. - with_named_thread="-lpthread" - else - AC_MSG_RESULT("Not found") - # If this is a linux machine we should barf - AC_MSG_CHECKING("NPTL") - if test "$IS_LINUX" = "true" - then - getconfres=`which getconf >/dev/null && getconf GNU_LIBPTHREAD_VERSION | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ |grep NPTL | wc -l || echo 0` - if test "$getconfres" -gt 0 + AC_MSG_RESULT("starting") + # use getconf to check glibc contents + AC_MSG_CHECKING("getconf GNU_LIBPTHREAD_VERSION") + case `getconf GNU_LIBPTHREAD_VERSION | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` in + NPTL* ) + AC_MSG_RESULT("NPTL") + AC_DEFINE([HAVE_NPTL], [1], [NPTL threads implementation]) + with_named_thread="-lpthread" + ;; + LINUXTHREADS* ) + AC_MSG_RESULT("Linuxthreads") + AC_DEFINE([HAVE_LINUXTHREADS], [1], + [Whether we are using Xavier Leroy's LinuxThreads]) + with_named_thread="-lpthread" + ;; + * ) + AC_MSG_RESULT("unknown") + ;; + esac + if test "$with_named_thread" = "no" then - AC_DEFINE(HAVE_LINUXTHREADS) dnl All this code predates NPTL, so "have linuxthreads" is a poor name. - with_named_thread="-lpthread" - else - AC_MSG_ERROR([This is a Linux system and neither Linuxthreads nor NPTL were -found. Please install Linuxthreads or a new glibc and try -again. See the Installation chapter in the Reference Manual for -more information.]) - fi - else - AC_MSG_CHECKING("DEC threads") - if test -f /usr/shlib/libpthread.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a - then - with_named_thread="-lpthread -lmach -lexc" - CFLAGS="$CFLAGS -D_REENTRANT" - CXXFLAGS="$CXXFLAGS -D_REENTRANT" - AC_DEFINE(HAVE_DEC_THREADS) - AC_MSG_RESULT("yes") - else - AC_MSG_RESULT("no") - AC_MSG_CHECKING("DEC 3.2 threads") - if test -f /usr/shlib/libpthreads.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a - then - with_named_thread="-lpthreads -lmach -lc_r" - AC_DEFINE(HAVE_DEC_THREADS) - AC_DEFINE(HAVE_DEC_3_2_THREADS) - with_osf32_threads="yes" - MYSQLD_DEFAULT_SWITCHES="--skip-thread-priority" - AC_MSG_RESULT("yes") - else - AC_MSG_RESULT("no") + # old method, check headers + # Look for LinuxThreads. + AC_MSG_CHECKING("LinuxThreads in header file comment") + res=`grep Linuxthreads /usr/include/pthread.h 2>/dev/null | wc -l` + if test "$res" -gt 0 + then + AC_MSG_RESULT("Found") + AC_DEFINE([HAVE_LINUXTHREADS], [1], + [Whether we are using Xavier Leroy's LinuxThreads]) + # Linux 2.0 sanity check + AC_TRY_COMPILE([#include ], [int a = sched_get_priority_min(1);], , + AC_MSG_ERROR([Syntax error in sched.h. Change _P to __P in the /usr/include/sched.h file. See the Installation chapter in the Reference Manual])) + # RedHat 5.0 does not work with dynamic linking of this. -static also + # gives a speed increase in linux so it does not hurt on other systems. + with_named_thread="-lpthread" + else + AC_MSG_RESULT("Not found") + # If this is a linux machine we should barf + AC_MSG_ERROR([This is a Linux system without a working getconf, +and Linuxthreads was not found. Please install it (or a new glibc) and try again. +See the Installation chapter in the Reference Manual for more information.]) fi - fi - fi - fi + else + AC_MSG_RESULT("no need to check headers") + fi + AC_MSG_CHECKING("for pthread_create in -lpthread"); + ac_save_LIBS="$LIBS" + LIBS="$LIBS -lpthread" + AC_TRY_LINK( [#include ], + [ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ], + AC_MSG_RESULT("yes"), + [ AC_MSG_RESULT("no") + AC_MSG_ERROR([ +This is a Linux system claiming to support threads, either Linuxthreads or NPTL, but linking a test program failed. +Please install one of these (or a new glibc) and try again. +See the Installation chapter in the Reference Manual for more information.]) ] + ) + LIBS="$ac_save_LIBS" + else + AC_MSG_RESULT("no") + fi # "$TARGET_LINUX" +fi # "$with_named_thread" = "no" -a "$with_mit_threads" = "no" + +if test "$with_named_thread" = "no" -a "$with_mit_threads" = "no" +then + AC_MSG_CHECKING("DEC threads") + if test -f /usr/shlib/libpthread.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a + then + with_named_thread="-lpthread -lmach -lexc" + CFLAGS="$CFLAGS -D_REENTRANT" + CXXFLAGS="$CXXFLAGS -D_REENTRANT" + AC_DEFINE(HAVE_DEC_THREADS) + AC_MSG_RESULT("yes") + else + AC_MSG_RESULT("no") + AC_MSG_CHECKING("DEC 3.2 threads") + if test -f /usr/shlib/libpthreads.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a + then + with_named_thread="-lpthreads -lmach -lc_r" + AC_DEFINE(HAVE_DEC_THREADS) + AC_DEFINE(HAVE_DEC_3_2_THREADS) + with_osf32_threads="yes" + MYSQLD_DEFAULT_SWITCHES="--skip-thread-priority" + AC_MSG_RESULT("yes") + else + AC_MSG_RESULT("no") + fi + fi fi @@ -1720,7 +1756,7 @@ fi AC_SUBST(COMPILATION_COMMENT) AC_MSG_CHECKING("need of special linking flags") -if test "$IS_LINUX" = "true" -a "$ac_cv_prog_gcc" = "yes" -a "$all_is_static" != "yes" +if test "$TARGET_LINUX" = "true" -a "$ac_cv_prog_gcc" = "yes" -a "$all_is_static" != "yes" then LDFLAGS="$LDFLAGS -rdynamic" AC_MSG_RESULT("-rdynamic") @@ -1873,6 +1909,7 @@ AC_CHECK_FUNCS(alarm bmove \ tell atod memcpy memmove \ setupterm strcasecmp sighold vidattr lrand48 localtime_r \ sigset sigthreadmask pthread_sigmask pthread_setprio pthread_setprio_np \ + sigaction sigemptyset sigaddset \ pthread_setschedparam pthread_attr_setprio pthread_attr_setschedparam \ pthread_attr_create pthread_getsequence_np pthread_attr_setstacksize \ pthread_attr_getstacksize pthread_key_delete \ @@ -1884,7 +1921,7 @@ CFLAGS="$ORG_CFLAGS" # Sanity check: We chould not have any fseeko symbol unless # large_file_support=yes AC_CHECK_FUNCS(fseeko, -[if test "$large_file_support" = no -a "$IS_LINUX" = "true"; +[if test "$large_file_support" = no -a "$TARGET_LINUX" = "true"; then AC_MSG_ERROR("Found fseeko symbol but large_file_support is not enabled!"); fi] diff --git a/include/my_global.h b/include/my_global.h index 37e53c65dec..e6bf9a9b840 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -97,7 +97,7 @@ /* Fix problem with S_ISLNK() on Linux */ -#if defined(HAVE_LINUXTHREADS) +#if defined(TARGET_OS_LINUX) || defined(__GLIBC__) #undef _GNU_SOURCE #define _GNU_SOURCE 1 #endif @@ -348,7 +348,10 @@ int __void__; #endif /* Define some useful general macros */ -#if !defined(max) +#if defined(__cplusplus) && defined(__GNUC__) +#define max(a, b) ((a) >? (b)) +#define min(a, b) ((a) (b) ? (a) : (b)) #define min(a, b) ((a) < (b) ? (a) : (b)) #endif diff --git a/include/my_pthread.h b/include/my_pthread.h index 7620b46e08b..e1a7ecab4ab 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -28,6 +28,14 @@ extern "C" { #endif /* __cplusplus */ +/* Thread library */ + +#define THD_LIB_OTHER 1 +#define THD_LIB_NPTL 2 +#define THD_LIB_LT 4 + +extern uint thd_lib_detected; + #if defined(__WIN__) || defined(OS2) #ifdef OS2 @@ -286,8 +294,8 @@ extern int my_pthread_create_detached; #undef HAVE_PTHREAD_RWLOCK_RDLOCK #undef HAVE_SNPRINTF -#define sigset(A,B) pthread_signal((A),(void (*)(int)) (B)) -#define signal(A,B) pthread_signal((A),(void (*)(int)) (B)) +#define my_sigset(A,B) pthread_signal((A),(void (*)(int)) (B)) +#define my_signal(A,B) pthread_signal((A),(void (*)(int)) (B)) #define my_pthread_attr_setprio(A,B) #endif /* defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM) */ @@ -324,14 +332,27 @@ extern int my_pthread_cond_init(pthread_cond_t *mp, #if !defined(HAVE_SIGWAIT) && !defined(HAVE_mit_thread) && !defined(HAVE_rts_threads) && !defined(sigwait) && !defined(alpha_linux_port) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS) && !defined(_AIX) int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */ #endif -#if !defined(HAVE_SIGSET) && !defined(HAVE_mit_thread) && !defined(sigset) -#define sigset(A,B) do { struct sigaction s; sigset_t set; \ - sigemptyset(&set); \ - s.sa_handler = (B); \ - s.sa_mask = set; \ - s.sa_flags = 0; \ - sigaction((A), &s, (struct sigaction *) NULL); \ + +/* + We define my_sigset() and use that instead of the system sigset() so that + we can favor an implementation based on sigaction(). On some systems, such + as Mac OS X, sigset() results in flags such as SA_RESTART being set, and + we want to make sure that no such flags are set. +*/ +#if defined(HAVE_SIGACTION) && !defined(my_sigset) +#define my_sigset(A,B) do { struct sigaction s; sigset_t set; int rc; \ + DBUG_ASSERT((A) != 0); \ + sigemptyset(&set); \ + s.sa_handler = (B); \ + s.sa_mask = set; \ + s.sa_flags = 0; \ + rc= sigaction((A), &s, (struct sigaction *) NULL); \ + DBUG_ASSERT(rc == 0); \ } while (0) +#elif defined(HAVE_SIGSET) && !defined(my_sigset) +#define my_sigset(A,B) sigset((A),(B)) +#elif !defined(my_sigset) +#define my_sigset(A,B) signal((A),(B)) #endif #ifndef my_pthread_setprio @@ -416,7 +437,7 @@ struct tm *localtime_r(const time_t *clock, struct tm *res); #undef pthread_detach_this_thread #define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(tmp); } #undef sigset -#define sigset(A,B) pthread_signal((A),(void (*)(int)) (B)) +#define my_sigset(A,B) pthread_signal((A),(void (*)(int)) (B)) #endif #if ((defined(HAVE_PTHREAD_ATTR_CREATE) && !defined(HAVE_SIGWAIT)) || defined(HAVE_DEC_3_2_THREADS)) && !defined(HAVE_CTHREADS_WRAPPER) diff --git a/include/thr_alarm.h b/include/thr_alarm.h index 7a10d6886ce..0c26a67acf4 100644 --- a/include/thr_alarm.h +++ b/include/thr_alarm.h @@ -25,11 +25,6 @@ extern "C" { #ifndef USE_ALARM_THREAD #define USE_ONE_SIGNAL_HAND /* One must call process_alarm */ #endif -#ifdef HAVE_LINUXTHREADS -#define THR_CLIENT_ALARM SIGALRM -#else -#define THR_CLIENT_ALARM SIGUSR1 -#endif #ifdef HAVE_rts_threads #undef USE_ONE_SIGNAL_HAND #define USE_ALARM_THREAD diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c index a8157cc2f91..3eaf27844b2 100644 --- a/mysys/my_pthread.c +++ b/mysys/my_pthread.c @@ -31,6 +31,8 @@ #define SCHED_POLICY SCHED_OTHER #endif +uint thd_lib_detected; + #ifndef my_pthread_setprio void my_pthread_setprio(pthread_t thread_id,int prior) { @@ -320,7 +322,7 @@ void *sigwait_thread(void *set_arg) sigaction(i, &sact, (struct sigaction*) 0); } } - sigaddset(set,THR_CLIENT_ALARM); + sigaddset(set, thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1); pthread_sigmask(SIG_UNBLOCK,(sigset_t*) set,(sigset_t*) 0); alarm_thread=pthread_self(); /* For thr_alarm */ diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c index 54aa4d421f6..54480b3908d 100644 --- a/mysys/thr_alarm.c +++ b/mysys/thr_alarm.c @@ -59,9 +59,7 @@ static void *alarm_handler(void *arg); #define reschedule_alarms() pthread_kill(alarm_thread,THR_SERVER_ALARM) #endif -#if THR_CLIENT_ALARM != SIGALRM || defined(USE_ALARM_THREAD) static sig_handler thread_alarm(int sig __attribute__((unused))); -#endif static int compare_ulong(void *not_used __attribute__((unused)), byte *a_ptr,byte* b_ptr) @@ -77,21 +75,16 @@ void init_thr_alarm(uint max_alarms) alarm_aborted=0; init_queue(&alarm_queue,max_alarms+1,offsetof(ALARM,expire_time),0, compare_ulong,NullS); - sigfillset(&full_signal_set); /* Neaded to block signals */ + sigfillset(&full_signal_set); /* Needed to block signals */ pthread_mutex_init(&LOCK_alarm,MY_MUTEX_INIT_FAST); pthread_cond_init(&COND_alarm,NULL); -#if THR_CLIENT_ALARM != SIGALRM || defined(USE_ALARM_THREAD) -#if defined(HAVE_mit_thread) - sigset(THR_CLIENT_ALARM,thread_alarm); /* int. thread system calls */ -#else +#ifndef USE_ALARM_THREAD + if (thd_lib_detected != THD_LIB_LT) +#endif { - struct sigaction sact; - sact.sa_flags = 0; - sact.sa_handler = thread_alarm; - sigaction(THR_CLIENT_ALARM, &sact, (struct sigaction*) 0); + my_sigset(thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1, + thread_alarm); } -#endif -#endif sigemptyset(&s); sigaddset(&s, THR_SERVER_ALARM); alarm_thread=pthread_self(); @@ -109,13 +102,15 @@ void init_thr_alarm(uint max_alarms) } #elif defined(USE_ONE_SIGNAL_HAND) pthread_sigmask(SIG_BLOCK, &s, NULL); /* used with sigwait() */ -#if THR_SERVER_ALARM == THR_CLIENT_ALARM - sigset(THR_CLIENT_ALARM,process_alarm); /* Linuxthreads */ - pthread_sigmask(SIG_UNBLOCK, &s, NULL); -#endif + if (thd_lib_detected == THD_LIB_LT) + { + my_sigset(thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1, + process_alarm); /* Linuxthreads */ + pthread_sigmask(SIG_UNBLOCK, &s, NULL); + } #else + my_sigset(THR_SERVER_ALARM, process_alarm); pthread_sigmask(SIG_UNBLOCK, &s, NULL); - sigset(THR_SERVER_ALARM,process_alarm); #endif DBUG_VOID_RETURN; } @@ -163,7 +158,7 @@ my_bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm_data) now=(ulong) time((time_t*) 0); pthread_sigmask(SIG_BLOCK,&full_signal_set,&old_mask); - pthread_mutex_lock(&LOCK_alarm); /* Lock from threads & alarms */ + pthread_mutex_lock(&LOCK_alarm); /* Lock from threads & alarms */ if (alarm_aborted > 0) { /* No signal thread */ DBUG_PRINT("info", ("alarm aborted")); @@ -249,7 +244,7 @@ void thr_end_alarm(thr_alarm_t *alarmed) if (alarm_data->malloced) my_free((gptr) alarm_data,MYF(0)); found++; -#ifndef DBUG_OFF +#ifdef DBUG_OFF break; #endif } @@ -258,10 +253,11 @@ void thr_end_alarm(thr_alarm_t *alarmed) if (!found) { if (*alarmed) - fprintf(stderr,"Warning: Didn't find alarm %lx in queue of %d alarms\n", - (long) *alarmed, alarm_queue.elements); - DBUG_PRINT("warning",("Didn't find alarm %lx in queue\n", - (long) *alarmed)); + fprintf(stderr, + "Warning: Didn't find alarm 0x%lx in queue of %d alarms\n", + (long) *alarmed, alarm_queue.elements); + DBUG_PRINT("warning",("Didn't find alarm 0x%lx in queue\n", + (long) *alarmed)); } pthread_mutex_unlock(&LOCK_alarm); pthread_sigmask(SIG_SETMASK,&old_mask,NULL); @@ -283,18 +279,18 @@ sig_handler process_alarm(int sig __attribute__((unused))) This must be first as we can't call DBUG inside an alarm for a normal thread */ -#if THR_SERVER_ALARM == THR_CLIENT_ALARM - if (!pthread_equal(pthread_self(),alarm_thread)) + if (thd_lib_detected == THD_LIB_LT && + !pthread_equal(pthread_self(),alarm_thread)) { #if defined(MAIN) && !defined(__bsdi__) - printf("thread_alarm\n"); fflush(stdout); + printf("thread_alarm in process_alarm\n"); fflush(stdout); #endif #ifdef DONT_REMEMBER_SIGNAL - sigset(THR_CLIENT_ALARM,process_alarm); /* int. thread system calls */ + my_sigset(thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1, + process_alarm); /* int. thread system calls */ #endif return; } -#endif /* We have to do do the handling of the alarm in a sub function, @@ -310,7 +306,7 @@ sig_handler process_alarm(int sig __attribute__((unused))) process_alarm_part2(sig); #ifndef USE_ALARM_THREAD #if defined(DONT_REMEMBER_SIGNAL) && !defined(USE_ONE_SIGNAL_HAND) - sigset(THR_SERVER_ALARM,process_alarm); + my_sigset(THR_SERVER_ALARM, process_alarm); #endif pthread_mutex_unlock(&LOCK_alarm); pthread_sigmask(SIG_SETMASK,&old_mask,NULL); @@ -338,7 +334,8 @@ static sig_handler process_alarm_part2(int sig __attribute__((unused))) alarm_data=(ALARM*) queue_element(&alarm_queue,i); alarm_data->alarmed=1; /* Info to thread */ if (pthread_equal(alarm_data->thread,alarm_thread) || - pthread_kill(alarm_data->thread, THR_CLIENT_ALARM)) + pthread_kill(alarm_data->thread, + thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1)) { #ifdef MAIN printf("Warning: pthread_kill couldn't find thread!!!\n"); @@ -362,7 +359,8 @@ static sig_handler process_alarm_part2(int sig __attribute__((unused))) alarm_data->alarmed=1; /* Info to thread */ DBUG_PRINT("info",("sending signal to waiting thread")); if (pthread_equal(alarm_data->thread,alarm_thread) || - pthread_kill(alarm_data->thread, THR_CLIENT_ALARM)) + pthread_kill(alarm_data->thread, + thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1)) { #ifdef MAIN printf("Warning: pthread_kill couldn't find thread!!!\n"); @@ -439,16 +437,13 @@ void end_thr_alarm(my_bool free_structures) if (error == ETIME || error == ETIMEDOUT) break; /* Don't wait forever */ } - if (!alarm_queue.elements) + delete_queue(&alarm_queue); + alarm_aborted= 1; + pthread_mutex_unlock(&LOCK_alarm); + if (!alarm_thread_running) /* Safety */ { - delete_queue(&alarm_queue); - alarm_aborted= 1; - pthread_mutex_unlock(&LOCK_alarm); - if (!alarm_thread_running) /* Safety */ - { - pthread_mutex_destroy(&LOCK_alarm); - pthread_cond_destroy(&COND_alarm); - } + pthread_mutex_destroy(&LOCK_alarm); + pthread_cond_destroy(&COND_alarm); } } else @@ -505,17 +500,15 @@ void thr_alarm_info(ALARM_INFO *info) ARGSUSED */ -#if THR_CLIENT_ALARM != SIGALRM || defined(USE_ALARM_THREAD) static sig_handler thread_alarm(int sig) { #ifdef MAIN printf("thread_alarm\n"); fflush(stdout); #endif #ifdef DONT_REMEMBER_SIGNAL - sigset(sig,thread_alarm); /* int. thread system calls */ + my_sigset(sig, thread_alarm); /* int. thread system calls */ #endif } -#endif #ifdef HAVE_TIMESPEC_TS_SEC @@ -916,7 +909,7 @@ static sig_handler print_signal_warning(int sig) printf("Warning: Got signal %d from thread %s\n",sig,my_thread_name()); fflush(stdout); #ifdef DONT_REMEMBER_SIGNAL - sigset(sig,print_signal_warning); /* int. thread system calls */ + my_sigset(sig, print_signal_warning); /* int. thread system calls */ #endif #ifndef OS2 if (sig == SIGALRM) @@ -943,9 +936,7 @@ static void *signal_hand(void *arg __attribute__((unused))) sigaddset(&set,SIGINT); sigaddset(&set,SIGQUIT); sigaddset(&set,SIGTERM); -#if THR_CLIENT_ALARM != SIGHUP sigaddset(&set,SIGHUP); -#endif #ifdef SIGTSTP sigaddset(&set,SIGTSTP); #endif @@ -957,7 +948,7 @@ static void *signal_hand(void *arg __attribute__((unused))) #endif #endif /* OS2 */ printf("server alarm: %d thread alarm: %d\n", - THR_SERVER_ALARM,THR_CLIENT_ALARM); + THR_SERVER_ALARM, thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1); DBUG_PRINT("info",("Starting signal and alarm handling thread")); for(;;) { @@ -1029,11 +1020,11 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused))) sigaddset(&set,SIGTSTP); #endif sigaddset(&set,THR_SERVER_ALARM); - sigdelset(&set,THR_CLIENT_ALARM); + sigdelset(&set, thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1); (void) pthread_sigmask(SIG_SETMASK,&set,NULL); #ifdef NOT_USED sigemptyset(&set); - sigaddset(&set,THR_CLIENT_ALARM); + sigaddset(&set, thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1); VOID(pthread_sigmask(SIG_UNBLOCK, &set, (sigset_t*) 0)); #endif #endif /* OS2 */ @@ -1083,8 +1074,8 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused))) } } pthread_mutex_unlock(&LOCK_thread_count); - end_thr_alarm(1); thr_alarm_info(&alarm_info); + end_thr_alarm(1); printf("Main_thread: Alarms: %u max_alarms: %u next_alarm_time: %lu\n", alarm_info.active_alarms, alarm_info.max_used_alarms, alarm_info.next_alarm_time); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 00bcdbf7132..d70fe9a1c32 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -177,12 +177,6 @@ inline void reset_floating_point_exceptions() } /* cplusplus */ -#if defined(HAVE_LINUXTHREADS) -#define THR_KILL_SIGNAL SIGINT -#else -#define THR_KILL_SIGNAL SIGUSR2 // Can't use this with LinuxThreads -#endif - #ifdef HAVE_GLIBC2_STYLE_GETHOSTBYNAME_R #include #else @@ -505,6 +499,7 @@ static void clean_up(bool print_message); static void clean_up_mutexes(void); static int test_if_case_insensitive(const char *dir_name); static void create_pid_file(); +static uint get_thread_lib(void); /**************************************************************************** ** Code to end mysqld @@ -544,7 +539,8 @@ static void close_connections(void) DBUG_PRINT("info",("Waiting for select_thread")); #ifndef DONT_USE_THR_ALARM - if (pthread_kill(select_thread,THR_CLIENT_ALARM)) + if (pthread_kill(select_thread, + thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1)) break; // allready dead #endif set_timespec(abstime, 2); @@ -844,7 +840,7 @@ extern "C" sig_handler print_signal_warning(int sig) sig,my_thread_id()); } #ifdef DONT_REMEMBER_SIGNAL - sigset(sig,print_signal_warning); /* int. thread system calls */ + my_sigset(sig, print_signal_warning); /* int. thread system calls */ #endif #if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__) if (sig == SIGALRM) @@ -1841,8 +1837,11 @@ static void init_signals(void) DBUG_ENTER("init_signals"); if (test_flags & TEST_SIGINT) - sigset(THR_KILL_SIGNAL,end_thread_signal); - sigset(THR_SERVER_ALARM,print_signal_warning); // Should never be called! + { + my_sigset(thd_lib_detected == THD_LIB_LT ? SIGINT : SIGUSR2, + end_thread_signal); + } + my_sigset(THR_SERVER_ALARM, print_signal_warning); // Should never be called! if (!(test_flags & TEST_NO_STACKTRACE) || (test_flags & TEST_CORE_ON_SIGNAL)) { @@ -1877,7 +1876,7 @@ static void init_signals(void) #endif (void) sigemptyset(&set); #ifdef THREAD_SPECIFIC_SIGPIPE - sigset(SIGPIPE,abort_thread); + my_sigset(SIGPIPE, abort_thread); sigaddset(&set,SIGPIPE); #else (void) signal(SIGPIPE,SIG_IGN); // Can't know which thread @@ -1903,8 +1902,12 @@ static void init_signals(void) #endif sigaddset(&set,THR_SERVER_ALARM); if (test_flags & TEST_SIGINT) - sigdelset(&set,THR_KILL_SIGNAL); // May be SIGINT - sigdelset(&set,THR_CLIENT_ALARM); // For alarms + { + // May be SIGINT + sigdelset(&set, thd_lib_detected == THD_LIB_LT ? SIGINT : SIGUSR2); + } + // For alarms + sigdelset(&set, thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1); sigprocmask(SIG_SETMASK,&set,NULL); pthread_sigmask(SIG_SETMASK,&set,NULL); DBUG_VOID_RETURN; @@ -1959,23 +1962,19 @@ extern "C" void *signal_hand(void *arg __attribute__((unused))) */ init_thr_alarm(max_connections + global_system_variables.max_insert_delayed_threads + 10); -#if SIGINT != THR_KILL_SIGNAL - if (test_flags & TEST_SIGINT) + if (thd_lib_detected != THD_LIB_LT && test_flags & TEST_SIGINT) { (void) sigemptyset(&set); // Setup up SIGINT for debug (void) sigaddset(&set,SIGINT); // For debugging (void) pthread_sigmask(SIG_UNBLOCK,&set,NULL); } -#endif (void) sigemptyset(&set); // Setup up SIGINT for debug #ifdef USE_ONE_SIGNAL_HAND (void) sigaddset(&set,THR_SERVER_ALARM); // For alarms #endif #ifndef IGNORE_SIGHUP_SIGQUIT (void) sigaddset(&set,SIGQUIT); -#if THR_CLIENT_ALARM != SIGHUP (void) sigaddset(&set,SIGHUP); -#endif #endif (void) sigaddset(&set,SIGTERM); (void) sigaddset(&set,SIGTSTP); @@ -2236,8 +2235,8 @@ int main(int argc, char **argv) MY_INIT(argv[0]); // init my_sys library & pthreads tzset(); // Set tzname + thd_lib_detected= get_thread_lib(); start_time=time((time_t*) 0); - #ifdef OS2 { // fix timezone for daylight saving @@ -5549,6 +5548,22 @@ static void create_pid_file() } +static uint get_thread_lib(void) +{ + char buff[64]; + +#ifdef _CS_GNU_LIBPTHREAD_VERSION + confstr(_CS_GNU_LIBPTHREAD_VERSION, buff, sizeof(buff)); + + if (!strncasecmp(buff, "NPTL", 4)) + return THD_LIB_NPTL; + else if (!strncasecmp(buff, "linuxthreads", 12)) + return THD_LIB_LT; +#endif + return THD_LIB_OTHER; +} + + /***************************************************************************** Instantiate templates *****************************************************************************/ From 292ba83f409b2b0f407400c9f662ed79a13da180 Mon Sep 17 00:00:00 2001 From: "tomas@poseidon.mysql.com" <> Date: Wed, 24 Jan 2007 09:41:40 +0700 Subject: [PATCH 02/11] Bug#25668 mysqld may core if cluster disconnected - recommit in 4.1 --- sql/ha_ndbcluster.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index fd9a5720e3d..d16e00f4e52 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -5373,7 +5373,7 @@ ndb_get_table_statistics(ha_ndbcluster* file, bool report_error, Ndb* ndb, retry: if(report_error) { - if (file) + if (file && pTrans) { reterr= file->ndb_err(pTrans); } From fdd8410e59f5cfe8037cba321b9f9bbd3b3ea748 Mon Sep 17 00:00:00 2001 From: "df@kahlann.erinye.com" <> Date: Thu, 25 Jan 2007 08:46:07 +0100 Subject: [PATCH 03/11] BUG#25530 --with-readline fails with commercial source packages --- BUILD/SETUP.sh | 11 ++++++++++- configure.in | 17 +++++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh index 6f3c4222ed2..7f979d765d3 100755 --- a/BUILD/SETUP.sh +++ b/BUILD/SETUP.sh @@ -84,7 +84,16 @@ debug_extra_cflags="-O1 -Wuninitialized" base_cxxflags="-felide-constructors -fno-exceptions -fno-rtti" amd64_cxxflags="" # If dropping '--with-big-tables', add here "-DBIG_TABLES" -base_configs="$prefix_configs --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-readline --with-big-tables" +base_configs="$prefix_configs --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables" + +if test -d "$path/../cmd-line-utils/readline" +then + base_configs="$base_configs --with-readline" +elif test -d "$path/../cmd-line-utils/libedit" +then + base_configs="$base_configs --with-libedit" +fi + static_link="--with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static" amd64_configs="" alpha_configs="" # Not used yet diff --git a/configure.in b/configure.in index cf1b4b0cd32..c6a8e20fd2f 100644 --- a/configure.in +++ b/configure.in @@ -2439,6 +2439,7 @@ readline_basedir="" readline_dir="" readline_h_ln_cmd="" readline_link="" +want_to_use_readline="no" if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null; then # For NetWare, do not need readline @@ -2463,6 +2464,7 @@ then readline_link="\$(top_builddir)/cmd-line-utils/readline/libreadline.a" readline_h_ln_cmd="\$(LN) -s \$(top_srcdir)/cmd-line-utils/readline readline" compile_readline=yes + want_to_use_readline="yes" AC_DEFINE_UNQUOTED(USE_NEW_READLINE_INTERFACE, 1) else # Use system readline library @@ -2472,10 +2474,12 @@ else MYSQL_CHECK_NEW_RL_INTERFACE MYSQL_CHECK_READLINE_DECLARES_HIST_ENTRY AC_LANG_RESTORE - if [test "$mysql_cv_new_rl_interface" = "yes"] + if [test "$mysql_cv_new_rl_interface" = "yes"] && [test -d "./cmd-line-utils/readline"] then - # Use the new readline interface + # Use the new readline interface, but only if the package includes a bundled libreadline + # this way we avoid linking commercial source with GPL readline readline_link="-lreadline" + want_to_use_readline="yes" elif [test "$mysql_cv_libedit_interface" = "yes"]; then # Use libedit readline_link="-ledit" @@ -2485,6 +2489,15 @@ else versions of libedit or readline]) fi fi + +# if there is no readline, but we want to build with readline, we fail +if [test "$want_to_use_readline" = "yes"] && [test ! -d "./cmd-line-utils/readline"] +then + AC_MSG_ERROR([This commercially licensed MySQL source package can't + be built with libreadline. Please use --with-libedit to use + the bundled version of libedit instead.]) +fi + fi AC_SUBST(readline_dir) From 32e83a6c3d3ca07d5bac0d8b1fb4e421252488e0 Mon Sep 17 00:00:00 2001 From: "joerg@trift2." <> Date: Thu, 25 Jan 2007 17:51:21 +0100 Subject: [PATCH 04/11] For Linux systems running RHEL 4 (which includes SE-Linux), we need to provide additional files that specify some actions which are allowed to the MySQL binaries. Create a new subdirectory "supportfiles/RHEL4-SElinux" for them, and process it. This fixes bug#12676. --- configure.in | 3 +- support-files/Makefile.am | 4 +- support-files/RHEL4-SElinux/Makefile.am | 23 +++++ support-files/RHEL4-SElinux/mysql.fc | 25 +++++ support-files/RHEL4-SElinux/mysql.te | 132 ++++++++++++++++++++++++ 5 files changed, 184 insertions(+), 3 deletions(-) create mode 100644 support-files/RHEL4-SElinux/Makefile.am create mode 100644 support-files/RHEL4-SElinux/mysql.fc create mode 100644 support-files/RHEL4-SElinux/mysql.te diff --git a/configure.in b/configure.in index e3bb541c9ec..80638e6ae98 100644 --- a/configure.in +++ b/configure.in @@ -2860,7 +2860,8 @@ AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl include/Makefile sql-bench/Makefile dnl server-tools/Makefile server-tools/instance-manager/Makefile dnl tests/Makefile Docs/Makefile support-files/Makefile dnl - support-files/MacOSX/Makefile mysql-test/Makefile dnl + support-files/MacOSX/Makefile support-files/RHEL4-SElinux/Makefile dnl + mysql-test/Makefile dnl netware/Makefile dnl include/mysql_version.h dnl cmd-line-utils/Makefile dnl diff --git a/support-files/Makefile.am b/support-files/Makefile.am index da8c25ccb1e..f2533100117 100644 --- a/support-files/Makefile.am +++ b/support-files/Makefile.am @@ -30,13 +30,13 @@ EXTRA_DIST = mysql.spec.sh \ MySQL-shared-compat.spec.sh \ ndb-config-2-node.ini.sh -SUBDIRS = MacOSX +SUBDIRS = MacOSX RHEL4-SElinux pkgdata_DATA = my-small.cnf \ my-medium.cnf \ my-large.cnf \ my-huge.cnf \ - my-innodb-heavy-4G.cnf \ + my-innodb-heavy-4G.cnf \ mysql-log-rotate \ binary-configure \ ndb-config-2-node.ini diff --git a/support-files/RHEL4-SElinux/Makefile.am b/support-files/RHEL4-SElinux/Makefile.am new file mode 100644 index 00000000000..52292136877 --- /dev/null +++ b/support-files/RHEL4-SElinux/Makefile.am @@ -0,0 +1,23 @@ +# Copyright (C) 2000-2001, 2003-2006 MySQL AB +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + +## Process this file with automake to create Makefile.in + +EXTRA_DIST = mysql.fc mysql.te + +# Don't update the files from bitkeeper +%::SCCS/s.% diff --git a/support-files/RHEL4-SElinux/mysql.fc b/support-files/RHEL4-SElinux/mysql.fc new file mode 100644 index 00000000000..0db0ccf6e68 --- /dev/null +++ b/support-files/RHEL4-SElinux/mysql.fc @@ -0,0 +1,25 @@ +# MySQL Database Server + +# +# /etc +# +/etc/my\.cnf -- gen_context(system_u:object_r:mysqld_etc_t,s0) +/etc/mysql(/.*)? gen_context(system_u:object_r:mysqld_etc_t,s0) + +# +# /usr +# Red Hat compatibility +/usr/libexec/mysqld -- gen_context(system_u:object_r:mysqld_exec_t,s0) + +# MySQL AB compatibility +/usr/sbin/mysqld(-max)? -- gen_context(system_u:object_r:mysqld_exec_t,s0) + +# +# /var +# +/var/lib/mysql(/.*)? gen_context(system_u:object_r:mysqld_db_t,s0) +/var/lib/mysql/mysql\.sock -s gen_context(system_u:object_r:mysqld_var_run_t,s0) + +/var/log/mysql.* -- gen_context(system_u:object_r:mysqld_log_t,s0) + +/var/run/mysqld(/.*)? gen_context(system_u:object_r:mysqld_var_run_t,s0) diff --git a/support-files/RHEL4-SElinux/mysql.te b/support-files/RHEL4-SElinux/mysql.te new file mode 100644 index 00000000000..b050fa7b1a6 --- /dev/null +++ b/support-files/RHEL4-SElinux/mysql.te @@ -0,0 +1,132 @@ + +policy_module(mysql,1.0.0) + +######################################## +# +# Declarations +# + +type mysqld_t; +type mysqld_exec_t; +init_daemon_domain(mysqld_t,mysqld_exec_t) + +type mysqld_var_run_t; +files_pid_file(mysqld_var_run_t) + +type mysqld_db_t; +files_type(mysqld_db_t) + +type mysqld_etc_t alias etc_mysqld_t; +files_config_file(mysqld_etc_t) + +type mysqld_log_t; +logging_log_file(mysqld_log_t) + +type mysqld_tmp_t; +files_tmp_file(mysqld_tmp_t) + +######################################## +# +# Local policy +# + +allow mysqld_t self:capability { dac_override setgid setuid sys_resource net_bind_service }; +dontaudit mysqld_t self:capability sys_tty_config; +allow mysqld_t self:process { setsched getsched setrlimit signal_perms rlimitinh }; +allow mysqld_t self:fifo_file { read write }; +allow mysqld_t self:unix_stream_socket create_stream_socket_perms; +allow mysqld_t self:tcp_socket create_stream_socket_perms; +allow mysqld_t self:udp_socket create_socket_perms; + +allow mysqld_t mysqld_db_t:dir create_dir_perms; +allow mysqld_t mysqld_db_t:file create_file_perms; +allow mysqld_t mysqld_db_t:lnk_file create_lnk_perms; +files_var_lib_filetrans(mysqld_t,mysqld_db_t,{ dir file }) + +allow mysqld_t mysqld_etc_t:file { getattr read }; +allow mysqld_t mysqld_etc_t:lnk_file { getattr read }; +allow mysqld_t mysqld_etc_t:dir list_dir_perms; + +allow mysqld_t mysqld_log_t:file create_file_perms; +logging_log_filetrans(mysqld_t,mysqld_log_t,file) + +allow mysqld_t mysqld_tmp_t:dir create_dir_perms; +allow mysqld_t mysqld_tmp_t:file create_file_perms; +files_tmp_filetrans(mysqld_t, mysqld_tmp_t, { file dir }) + +allow mysqld_t mysqld_var_run_t:dir rw_dir_perms; +allow mysqld_t mysqld_var_run_t:sock_file create_file_perms; +allow mysqld_t mysqld_var_run_t:file create_file_perms; +files_pid_filetrans(mysqld_t,mysqld_var_run_t,file) + +kernel_read_system_state(mysqld_t) +kernel_read_kernel_sysctls(mysqld_t) + +corenet_non_ipsec_sendrecv(mysqld_t) +corenet_tcp_sendrecv_all_if(mysqld_t) +corenet_udp_sendrecv_all_if(mysqld_t) +corenet_tcp_sendrecv_all_nodes(mysqld_t) +corenet_udp_sendrecv_all_nodes(mysqld_t) +corenet_tcp_sendrecv_all_ports(mysqld_t) +corenet_udp_sendrecv_all_ports(mysqld_t) +corenet_tcp_bind_all_nodes(mysqld_t) +corenet_tcp_bind_mysqld_port(mysqld_t) +corenet_tcp_connect_mysqld_port(mysqld_t) +corenet_sendrecv_mysqld_client_packets(mysqld_t) +corenet_sendrecv_mysqld_server_packets(mysqld_t) + +dev_read_sysfs(mysqld_t) + +fs_getattr_all_fs(mysqld_t) +fs_search_auto_mountpoints(mysqld_t) + +term_dontaudit_use_console(mysqld_t) + +domain_use_interactive_fds(mysqld_t) + +files_getattr_var_lib_dirs(mysqld_t) +files_read_etc_runtime_files(mysqld_t) +files_read_etc_files(mysqld_t) +files_read_usr_files(mysqld_t) +files_search_var_lib(mysqld_t) + +auth_use_nsswitch(mysqld_t) + +init_use_fds(mysqld_t) +init_use_script_ptys(mysqld_t) + +libs_use_ld_so(mysqld_t) +libs_use_shared_libs(mysqld_t) + +logging_send_syslog_msg(mysqld_t) + +miscfiles_read_localization(mysqld_t) + +sysnet_read_config(mysqld_t) + +userdom_dontaudit_use_unpriv_user_fds(mysqld_t) +# for /root/.my.cnf - should not be needed: +userdom_read_sysadm_home_content_files(mysqld_t) + +ifdef(`distro_redhat',` + # because Fedora has the sock_file in the database directory + type_transition mysqld_t mysqld_db_t:sock_file mysqld_var_run_t; +') + +ifdef(`targeted_policy',` + term_dontaudit_use_unallocated_ttys(mysqld_t) + term_dontaudit_use_generic_ptys(mysqld_t) + files_dontaudit_read_root_files(mysqld_t) +') + +optional_policy(` + daemontools_service_domain(mysqld_t, mysqld_exec_t) +') + +optional_policy(` + seutil_sigchld_newrole(mysqld_t) +') + +optional_policy(` + udev_read_db(mysqld_t) +') From 0b4ee9e5b8cee5af84295d76345d917788ebe294 Mon Sep 17 00:00:00 2001 From: "jani@ua141d10.elisa.omakaista.fi" <> Date: Thu, 25 Jan 2007 20:10:31 +0200 Subject: [PATCH 05/11] Cleanup of thread-type (linuxthread or NTPL) detection code Move get_thread_lib to mysys/my_pthread.c Set 'thr_client_alarm' to signal number used by thr_alarm to give alarms --- include/my_global.h | 5 +---- include/my_pthread.h | 16 ++++++++-------- include/thr_alarm.h | 2 ++ mysys/default.c | 4 ++-- mysys/my_pthread.c | 4 +++- mysys/my_thr_init.c | 20 ++++++++++++++++++++ mysys/thr_alarm.c | 26 +++++++++++++------------- sql/mysqld.cc | 34 +++++++++------------------------- 8 files changed, 58 insertions(+), 53 deletions(-) diff --git a/include/my_global.h b/include/my_global.h index e6bf9a9b840..f0e600e386d 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -348,10 +348,7 @@ int __void__; #endif /* Define some useful general macros */ -#if defined(__cplusplus) && defined(__GNUC__) -#define max(a, b) ((a) >? (b)) -#define min(a, b) ((a) (b) ? (a) : (b)) #define min(a, b) ((a) < (b) ? (a) : (b)) #endif diff --git a/include/my_pthread.h b/include/my_pthread.h index e1a7ecab4ab..9d5e78bba44 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -28,14 +28,6 @@ extern "C" { #endif /* __cplusplus */ -/* Thread library */ - -#define THD_LIB_OTHER 1 -#define THD_LIB_NPTL 2 -#define THD_LIB_LT 4 - -extern uint thd_lib_detected; - #if defined(__WIN__) || defined(OS2) #ifdef OS2 @@ -684,6 +676,14 @@ extern struct st_my_thread_var *_my_thread_var(void) __attribute__ ((const)); */ extern pthread_t shutdown_th, main_th, signal_th; +/* Which kind of thread library is in use */ + +#define THD_LIB_OTHER 1 +#define THD_LIB_NPTL 2 +#define THD_LIB_LT 4 + +extern uint thd_lib_detected; + /* statistics_xxx functions are for not essential statistic */ #ifndef thread_safe_increment diff --git a/include/thr_alarm.h b/include/thr_alarm.h index 0c26a67acf4..ef6aaf49f77 100644 --- a/include/thr_alarm.h +++ b/include/thr_alarm.h @@ -93,6 +93,8 @@ typedef struct st_alarm { my_bool malloced; } ALARM; +extern uint thr_client_alarm; + #define thr_alarm_init(A) (*(A))=0 #define thr_alarm_in_use(A) (*(A)!= 0) void init_thr_alarm(uint max_alarm); diff --git a/mysys/default.c b/mysys/default.c index 25e283a9650..911f516dad8 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -282,7 +282,7 @@ static int search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc, { char **ext; - for (ext= (char**) f_extensions; *ext; *ext++) + for (ext= (char**) f_extensions; *ext; ext++) { int error; if ((error= search_default_file_with_ext(args, alloc, dir, *ext, @@ -543,7 +543,7 @@ void print_defaults(const char *conf_file, const char **groups) #endif for (dirs=default_directories ; *dirs; dirs++) { - for (ext= (char**) f_extensions; *ext; *ext++) + for (ext= (char**) f_extensions; *ext; ext++) { const char *pos; char *end; diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c index 3eaf27844b2..19766a2d195 100644 --- a/mysys/my_pthread.c +++ b/mysys/my_pthread.c @@ -322,7 +322,9 @@ void *sigwait_thread(void *set_arg) sigaction(i, &sact, (struct sigaction*) 0); } } - sigaddset(set, thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1); + /* Ensure that init_thr_alarm() is called */ + DBUG_ASSERT(thr_client_alarm); + sigaddset(set, thr_client_alarm); pthread_sigmask(SIG_UNBLOCK,(sigset_t*) set,(sigset_t*) 0); alarm_thread=pthread_self(); /* For thr_alarm */ diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index 878a861bc94..51b31f78a1c 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -44,6 +44,8 @@ pthread_mutexattr_t my_fast_mutexattr; pthread_mutexattr_t my_errchk_mutexattr; #endif +static uint get_thread_lib(void); + /* initialize thread environment @@ -57,6 +59,8 @@ pthread_mutexattr_t my_errchk_mutexattr; my_bool my_thread_global_init(void) { + thd_lib_detected= get_thread_lib(); + if (pthread_key_create(&THR_KEY_mysys,0)) { fprintf(stderr,"Can't initialize threads: error %d\n",errno); @@ -276,4 +280,20 @@ const char *my_thread_name(void) } #endif /* DBUG_OFF */ + +static uint get_thread_lib(void) +{ + char buff[64]; + +#ifdef _CS_GNU_LIBPTHREAD_VERSION + confstr(_CS_GNU_LIBPTHREAD_VERSION, buff, sizeof(buff)); + + if (!strncasecmp(buff, "NPTL", 4)) + return THD_LIB_NPTL; + if (!strncasecmp(buff, "linuxthreads", 12)) + return THD_LIB_LT; +#endif + return THD_LIB_OTHER; +} + #endif /* THREAD */ diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c index 54480b3908d..8f342e269de 100644 --- a/mysys/thr_alarm.c +++ b/mysys/thr_alarm.c @@ -37,6 +37,7 @@ #define ETIME ETIMEDOUT #endif +uint thr_client_alarm; static int alarm_aborted=1; /* No alarm thread */ my_bool thr_alarm_inited= 0; volatile my_bool alarm_thread_running= 0; @@ -78,12 +79,15 @@ void init_thr_alarm(uint max_alarms) sigfillset(&full_signal_set); /* Needed to block signals */ pthread_mutex_init(&LOCK_alarm,MY_MUTEX_INIT_FAST); pthread_cond_init(&COND_alarm,NULL); + if (thd_lib_detected == THD_LIB_LT) + thr_client_alarm= SIGALRM; + else + thr_client_alarm= SIGUSR1; #ifndef USE_ALARM_THREAD if (thd_lib_detected != THD_LIB_LT) #endif { - my_sigset(thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1, - thread_alarm); + my_sigset(thr_client_alarm, thread_alarm); } sigemptyset(&s); sigaddset(&s, THR_SERVER_ALARM); @@ -104,8 +108,7 @@ void init_thr_alarm(uint max_alarms) pthread_sigmask(SIG_BLOCK, &s, NULL); /* used with sigwait() */ if (thd_lib_detected == THD_LIB_LT) { - my_sigset(thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1, - process_alarm); /* Linuxthreads */ + my_sigset(thr_client_alarm, process_alarm); /* Linuxthreads */ pthread_sigmask(SIG_UNBLOCK, &s, NULL); } #else @@ -286,8 +289,7 @@ sig_handler process_alarm(int sig __attribute__((unused))) printf("thread_alarm in process_alarm\n"); fflush(stdout); #endif #ifdef DONT_REMEMBER_SIGNAL - my_sigset(thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1, - process_alarm); /* int. thread system calls */ + my_sigset(thr_client_alarm, process_alarm); /* int. thread system calls */ #endif return; } @@ -334,8 +336,7 @@ static sig_handler process_alarm_part2(int sig __attribute__((unused))) alarm_data=(ALARM*) queue_element(&alarm_queue,i); alarm_data->alarmed=1; /* Info to thread */ if (pthread_equal(alarm_data->thread,alarm_thread) || - pthread_kill(alarm_data->thread, - thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1)) + pthread_kill(alarm_data->thread, thr_client_alarm)) { #ifdef MAIN printf("Warning: pthread_kill couldn't find thread!!!\n"); @@ -359,8 +360,7 @@ static sig_handler process_alarm_part2(int sig __attribute__((unused))) alarm_data->alarmed=1; /* Info to thread */ DBUG_PRINT("info",("sending signal to waiting thread")); if (pthread_equal(alarm_data->thread,alarm_thread) || - pthread_kill(alarm_data->thread, - thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1)) + pthread_kill(alarm_data->thread, thr_client_alarm)) { #ifdef MAIN printf("Warning: pthread_kill couldn't find thread!!!\n"); @@ -948,7 +948,7 @@ static void *signal_hand(void *arg __attribute__((unused))) #endif #endif /* OS2 */ printf("server alarm: %d thread alarm: %d\n", - THR_SERVER_ALARM, thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1); + THR_SERVER_ALARM, thr_client_alarm); DBUG_PRINT("info",("Starting signal and alarm handling thread")); for(;;) { @@ -1020,11 +1020,11 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused))) sigaddset(&set,SIGTSTP); #endif sigaddset(&set,THR_SERVER_ALARM); - sigdelset(&set, thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1); + sigdelset(&set, thr_client_alarm); (void) pthread_sigmask(SIG_SETMASK,&set,NULL); #ifdef NOT_USED sigemptyset(&set); - sigaddset(&set, thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1); + sigaddset(&set, thr_client_alarm); VOID(pthread_sigmask(SIG_UNBLOCK, &set, (sigset_t*) 0)); #endif #endif /* OS2 */ diff --git a/sql/mysqld.cc b/sql/mysqld.cc index d70fe9a1c32..43d76f28007 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -459,6 +459,7 @@ pthread_cond_t COND_refresh,COND_thread_count, COND_slave_stopped, pthread_cond_t COND_thread_cache,COND_flush_thread_cache; pthread_t signal_thread; pthread_attr_t connection_attrib; +static uint thr_kill_signal; #ifdef __WIN__ #undef getpid @@ -499,7 +500,6 @@ static void clean_up(bool print_message); static void clean_up_mutexes(void); static int test_if_case_insensitive(const char *dir_name); static void create_pid_file(); -static uint get_thread_lib(void); /**************************************************************************** ** Code to end mysqld @@ -539,8 +539,7 @@ static void close_connections(void) DBUG_PRINT("info",("Waiting for select_thread")); #ifndef DONT_USE_THR_ALARM - if (pthread_kill(select_thread, - thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1)) + if (pthread_kill(select_thread, thr_client_alarm)) break; // allready dead #endif set_timespec(abstime, 2); @@ -1838,8 +1837,7 @@ static void init_signals(void) if (test_flags & TEST_SIGINT) { - my_sigset(thd_lib_detected == THD_LIB_LT ? SIGINT : SIGUSR2, - end_thread_signal); + my_sigset(thr_kill_signal, end_thread_signal); } my_sigset(THR_SERVER_ALARM, print_signal_warning); // Should never be called! @@ -1904,10 +1902,10 @@ static void init_signals(void) if (test_flags & TEST_SIGINT) { // May be SIGINT - sigdelset(&set, thd_lib_detected == THD_LIB_LT ? SIGINT : SIGUSR2); + sigdelset(&set, thr_kill_signal); } // For alarms - sigdelset(&set, thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1); + sigdelset(&set, thr_client_alarm); sigprocmask(SIG_SETMASK,&set,NULL); pthread_sigmask(SIG_SETMASK,&set,NULL); DBUG_VOID_RETURN; @@ -1962,7 +1960,7 @@ extern "C" void *signal_hand(void *arg __attribute__((unused))) */ init_thr_alarm(max_connections + global_system_variables.max_insert_delayed_threads + 10); - if (thd_lib_detected != THD_LIB_LT && test_flags & TEST_SIGINT) + if (thd_lib_detected != THD_LIB_LT && (test_flags & TEST_SIGINT)) { (void) sigemptyset(&set); // Setup up SIGINT for debug (void) sigaddset(&set,SIGINT); // For debugging @@ -2235,7 +2233,6 @@ int main(int argc, char **argv) MY_INIT(argv[0]); // init my_sys library & pthreads tzset(); // Set tzname - thd_lib_detected= get_thread_lib(); start_time=time((time_t*) 0); #ifdef OS2 { @@ -2253,6 +2250,9 @@ int main(int argc, char **argv) } #endif + /* Set signal used to kill MySQL */ + thr_kill_signal= thd_lib_detected == THD_LIB_LT ? SIGINT : SIGUSR2; + /* Init mutexes for the global MYSQL_LOG objects. As safe_mutex depends on what MY_INIT() does, we can't init the mutexes of @@ -5548,22 +5548,6 @@ static void create_pid_file() } -static uint get_thread_lib(void) -{ - char buff[64]; - -#ifdef _CS_GNU_LIBPTHREAD_VERSION - confstr(_CS_GNU_LIBPTHREAD_VERSION, buff, sizeof(buff)); - - if (!strncasecmp(buff, "NPTL", 4)) - return THD_LIB_NPTL; - else if (!strncasecmp(buff, "linuxthreads", 12)) - return THD_LIB_LT; -#endif - return THD_LIB_OTHER; -} - - /***************************************************************************** Instantiate templates *****************************************************************************/ From b3523e398cb3eb4b391d60183da6ce2ac959c212 Mon Sep 17 00:00:00 2001 From: "jani@ua141d10.elisa.omakaista.fi" <> Date: Tue, 30 Jan 2007 18:52:26 +0200 Subject: [PATCH 06/11] Cleanup of thread-type (linuxthread or NTPL) detection code Move get_thread_lib to mysys/my_pthread.c Set 'thr_client_alarm' to signal number used by thr_alarm to give alarms --- include/my_global.h | 5 +---- include/my_pthread.h | 17 +++++++++-------- mysys/default.c | 4 ++-- mysys/my_pthread.c | 5 ++++- mysys/my_thr_init.c | 25 +++++++++++++++++++++++++ mysys/thr_alarm.c | 21 ++++++++------------- sql/mysqld.cc | 34 +++++++++------------------------- 7 files changed, 58 insertions(+), 53 deletions(-) diff --git a/include/my_global.h b/include/my_global.h index e6bf9a9b840..f0e600e386d 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -348,10 +348,7 @@ int __void__; #endif /* Define some useful general macros */ -#if defined(__cplusplus) && defined(__GNUC__) -#define max(a, b) ((a) >? (b)) -#define min(a, b) ((a) (b) ? (a) : (b)) #define min(a, b) ((a) < (b) ? (a) : (b)) #endif diff --git a/include/my_pthread.h b/include/my_pthread.h index e1a7ecab4ab..a336d4dc288 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -28,14 +28,6 @@ extern "C" { #endif /* __cplusplus */ -/* Thread library */ - -#define THD_LIB_OTHER 1 -#define THD_LIB_NPTL 2 -#define THD_LIB_LT 4 - -extern uint thd_lib_detected; - #if defined(__WIN__) || defined(OS2) #ifdef OS2 @@ -684,6 +676,15 @@ extern struct st_my_thread_var *_my_thread_var(void) __attribute__ ((const)); */ extern pthread_t shutdown_th, main_th, signal_th; +/* Which kind of thread library is in use */ + +#define THD_LIB_OTHER 1 +#define THD_LIB_NPTL 2 +#define THD_LIB_LT 4 + +extern uint thd_lib_detected; +extern uint thr_client_alarm; + /* statistics_xxx functions are for not essential statistic */ #ifndef thread_safe_increment diff --git a/mysys/default.c b/mysys/default.c index 25e283a9650..911f516dad8 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -282,7 +282,7 @@ static int search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc, { char **ext; - for (ext= (char**) f_extensions; *ext; *ext++) + for (ext= (char**) f_extensions; *ext; ext++) { int error; if ((error= search_default_file_with_ext(args, alloc, dir, *ext, @@ -543,7 +543,7 @@ void print_defaults(const char *conf_file, const char **groups) #endif for (dirs=default_directories ; *dirs; dirs++) { - for (ext= (char**) f_extensions; *ext; *ext++) + for (ext= (char**) f_extensions; *ext; ext++) { const char *pos; char *end; diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c index 3eaf27844b2..fd716448e43 100644 --- a/mysys/my_pthread.c +++ b/mysys/my_pthread.c @@ -32,6 +32,7 @@ #endif uint thd_lib_detected; +uint thr_client_alarm; #ifndef my_pthread_setprio void my_pthread_setprio(pthread_t thread_id,int prior) @@ -322,7 +323,9 @@ void *sigwait_thread(void *set_arg) sigaction(i, &sact, (struct sigaction*) 0); } } - sigaddset(set, thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1); + /* Ensure that init_thr_alarm() is called */ + DBUG_ASSERT(thr_client_alarm); + sigaddset(set, thr_client_alarm); pthread_sigmask(SIG_UNBLOCK,(sigset_t*) set,(sigset_t*) 0); alarm_thread=pthread_self(); /* For thr_alarm */ diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index 878a861bc94..5729f27b7a7 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -21,6 +21,7 @@ #include "mysys_priv.h" #include +#include #ifdef THREAD #ifdef USE_TLS @@ -44,6 +45,8 @@ pthread_mutexattr_t my_fast_mutexattr; pthread_mutexattr_t my_errchk_mutexattr; #endif +static uint get_thread_lib(void); + /* initialize thread environment @@ -57,6 +60,12 @@ pthread_mutexattr_t my_errchk_mutexattr; my_bool my_thread_global_init(void) { + thd_lib_detected= get_thread_lib(); + if (thd_lib_detected == THD_LIB_LT) + thr_client_alarm= SIGALRM; + else + thr_client_alarm= SIGUSR1; + if (pthread_key_create(&THR_KEY_mysys,0)) { fprintf(stderr,"Can't initialize threads: error %d\n",errno); @@ -276,4 +285,20 @@ const char *my_thread_name(void) } #endif /* DBUG_OFF */ + +static uint get_thread_lib(void) +{ + char buff[64]; + +#ifdef _CS_GNU_LIBPTHREAD_VERSION + confstr(_CS_GNU_LIBPTHREAD_VERSION, buff, sizeof(buff)); + + if (!strncasecmp(buff, "NPTL", 4)) + return THD_LIB_NPTL; + if (!strncasecmp(buff, "linuxthreads", 12)) + return THD_LIB_LT; +#endif + return THD_LIB_OTHER; +} + #endif /* THREAD */ diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c index 54480b3908d..fd1e48d730a 100644 --- a/mysys/thr_alarm.c +++ b/mysys/thr_alarm.c @@ -82,8 +82,7 @@ void init_thr_alarm(uint max_alarms) if (thd_lib_detected != THD_LIB_LT) #endif { - my_sigset(thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1, - thread_alarm); + my_sigset(thr_client_alarm, thread_alarm); } sigemptyset(&s); sigaddset(&s, THR_SERVER_ALARM); @@ -104,8 +103,7 @@ void init_thr_alarm(uint max_alarms) pthread_sigmask(SIG_BLOCK, &s, NULL); /* used with sigwait() */ if (thd_lib_detected == THD_LIB_LT) { - my_sigset(thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1, - process_alarm); /* Linuxthreads */ + my_sigset(thr_client_alarm, process_alarm); /* Linuxthreads */ pthread_sigmask(SIG_UNBLOCK, &s, NULL); } #else @@ -286,8 +284,7 @@ sig_handler process_alarm(int sig __attribute__((unused))) printf("thread_alarm in process_alarm\n"); fflush(stdout); #endif #ifdef DONT_REMEMBER_SIGNAL - my_sigset(thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1, - process_alarm); /* int. thread system calls */ + my_sigset(thr_client_alarm, process_alarm); /* int. thread system calls */ #endif return; } @@ -334,8 +331,7 @@ static sig_handler process_alarm_part2(int sig __attribute__((unused))) alarm_data=(ALARM*) queue_element(&alarm_queue,i); alarm_data->alarmed=1; /* Info to thread */ if (pthread_equal(alarm_data->thread,alarm_thread) || - pthread_kill(alarm_data->thread, - thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1)) + pthread_kill(alarm_data->thread, thr_client_alarm)) { #ifdef MAIN printf("Warning: pthread_kill couldn't find thread!!!\n"); @@ -359,8 +355,7 @@ static sig_handler process_alarm_part2(int sig __attribute__((unused))) alarm_data->alarmed=1; /* Info to thread */ DBUG_PRINT("info",("sending signal to waiting thread")); if (pthread_equal(alarm_data->thread,alarm_thread) || - pthread_kill(alarm_data->thread, - thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1)) + pthread_kill(alarm_data->thread, thr_client_alarm)) { #ifdef MAIN printf("Warning: pthread_kill couldn't find thread!!!\n"); @@ -948,7 +943,7 @@ static void *signal_hand(void *arg __attribute__((unused))) #endif #endif /* OS2 */ printf("server alarm: %d thread alarm: %d\n", - THR_SERVER_ALARM, thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1); + THR_SERVER_ALARM, thr_client_alarm); DBUG_PRINT("info",("Starting signal and alarm handling thread")); for(;;) { @@ -1020,11 +1015,11 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused))) sigaddset(&set,SIGTSTP); #endif sigaddset(&set,THR_SERVER_ALARM); - sigdelset(&set, thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1); + sigdelset(&set, thr_client_alarm); (void) pthread_sigmask(SIG_SETMASK,&set,NULL); #ifdef NOT_USED sigemptyset(&set); - sigaddset(&set, thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1); + sigaddset(&set, thr_client_alarm); VOID(pthread_sigmask(SIG_UNBLOCK, &set, (sigset_t*) 0)); #endif #endif /* OS2 */ diff --git a/sql/mysqld.cc b/sql/mysqld.cc index d70fe9a1c32..43d76f28007 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -459,6 +459,7 @@ pthread_cond_t COND_refresh,COND_thread_count, COND_slave_stopped, pthread_cond_t COND_thread_cache,COND_flush_thread_cache; pthread_t signal_thread; pthread_attr_t connection_attrib; +static uint thr_kill_signal; #ifdef __WIN__ #undef getpid @@ -499,7 +500,6 @@ static void clean_up(bool print_message); static void clean_up_mutexes(void); static int test_if_case_insensitive(const char *dir_name); static void create_pid_file(); -static uint get_thread_lib(void); /**************************************************************************** ** Code to end mysqld @@ -539,8 +539,7 @@ static void close_connections(void) DBUG_PRINT("info",("Waiting for select_thread")); #ifndef DONT_USE_THR_ALARM - if (pthread_kill(select_thread, - thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1)) + if (pthread_kill(select_thread, thr_client_alarm)) break; // allready dead #endif set_timespec(abstime, 2); @@ -1838,8 +1837,7 @@ static void init_signals(void) if (test_flags & TEST_SIGINT) { - my_sigset(thd_lib_detected == THD_LIB_LT ? SIGINT : SIGUSR2, - end_thread_signal); + my_sigset(thr_kill_signal, end_thread_signal); } my_sigset(THR_SERVER_ALARM, print_signal_warning); // Should never be called! @@ -1904,10 +1902,10 @@ static void init_signals(void) if (test_flags & TEST_SIGINT) { // May be SIGINT - sigdelset(&set, thd_lib_detected == THD_LIB_LT ? SIGINT : SIGUSR2); + sigdelset(&set, thr_kill_signal); } // For alarms - sigdelset(&set, thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1); + sigdelset(&set, thr_client_alarm); sigprocmask(SIG_SETMASK,&set,NULL); pthread_sigmask(SIG_SETMASK,&set,NULL); DBUG_VOID_RETURN; @@ -1962,7 +1960,7 @@ extern "C" void *signal_hand(void *arg __attribute__((unused))) */ init_thr_alarm(max_connections + global_system_variables.max_insert_delayed_threads + 10); - if (thd_lib_detected != THD_LIB_LT && test_flags & TEST_SIGINT) + if (thd_lib_detected != THD_LIB_LT && (test_flags & TEST_SIGINT)) { (void) sigemptyset(&set); // Setup up SIGINT for debug (void) sigaddset(&set,SIGINT); // For debugging @@ -2235,7 +2233,6 @@ int main(int argc, char **argv) MY_INIT(argv[0]); // init my_sys library & pthreads tzset(); // Set tzname - thd_lib_detected= get_thread_lib(); start_time=time((time_t*) 0); #ifdef OS2 { @@ -2253,6 +2250,9 @@ int main(int argc, char **argv) } #endif + /* Set signal used to kill MySQL */ + thr_kill_signal= thd_lib_detected == THD_LIB_LT ? SIGINT : SIGUSR2; + /* Init mutexes for the global MYSQL_LOG objects. As safe_mutex depends on what MY_INIT() does, we can't init the mutexes of @@ -5548,22 +5548,6 @@ static void create_pid_file() } -static uint get_thread_lib(void) -{ - char buff[64]; - -#ifdef _CS_GNU_LIBPTHREAD_VERSION - confstr(_CS_GNU_LIBPTHREAD_VERSION, buff, sizeof(buff)); - - if (!strncasecmp(buff, "NPTL", 4)) - return THD_LIB_NPTL; - else if (!strncasecmp(buff, "linuxthreads", 12)) - return THD_LIB_LT; -#endif - return THD_LIB_OTHER; -} - - /***************************************************************************** Instantiate templates *****************************************************************************/ From e580bd6c6f8e56dcc8566384b53990ffe3b48d2d Mon Sep 17 00:00:00 2001 From: "kent@mysql.com/kent-amd64.(none)" <> Date: Wed, 31 Jan 2007 00:06:42 +0100 Subject: [PATCH 07/11] gen_lex_hash.cc: If inserting a GPL header, include a complete one Makefile.am, mysql.dsw, mysql.sln: Removed C version of mysql-test-run mysql.spec.sh: Specify GPL license only in GPL sources .del-my_manage.h: Delete: mysql-test/my_manage.h mysql.spec.sh: Added GPL header .del-mysql_test_run_new.c: Delete: mysql-test/mysql_test_run_new.c .del-mysql_test_run_new.dsp: Delete: VC++Files/mysql-test/mysql_test_run_new.dsp .del-my_create_tables.c: Delete: mysql-test/my_create_tables.c .del-mysql_test_run_new_ia64.dsp: Delete: VC++Files/mysql-test/mysql_test_run_new_ia64.dsp msql2mysql.sh: Use up-to-date GPL header .del-mysql_test_run_new.vcproj: Delete: VC++Files/mysql-test/mysql_test_run_new.vcproj .del-my_manage.c: Delete: mysql-test/my_manage.c --- VC++Files/mysql-test/mysql_test_run_new.dsp | 106 - .../mysql-test/mysql_test_run_new.vcproj | 204 -- .../mysql-test/mysql_test_run_new_ia64.dsp | 142 -- VC++Files/mysql.dsw | 22 - VC++Files/mysql.sln | 34 - mysql-test/Makefile.am | 2 - mysql-test/my_create_tables.c | 688 ------ mysql-test/my_manage.c | 887 -------- mysql-test/my_manage.h | 137 -- mysql-test/mysql_test_run_new.c | 1941 ----------------- scripts/msql2mysql.sh | 24 +- sql/gen_lex_hash.cc | 22 +- support-files/mysql.spec.sh | 34 +- 13 files changed, 53 insertions(+), 4190 deletions(-) delete mode 100644 VC++Files/mysql-test/mysql_test_run_new.dsp delete mode 100644 VC++Files/mysql-test/mysql_test_run_new.vcproj delete mode 100644 VC++Files/mysql-test/mysql_test_run_new_ia64.dsp delete mode 100644 mysql-test/my_create_tables.c delete mode 100644 mysql-test/my_manage.c delete mode 100644 mysql-test/my_manage.h delete mode 100644 mysql-test/mysql_test_run_new.c diff --git a/VC++Files/mysql-test/mysql_test_run_new.dsp b/VC++Files/mysql-test/mysql_test_run_new.dsp deleted file mode 100644 index 5ff07f0994d..00000000000 --- a/VC++Files/mysql-test/mysql_test_run_new.dsp +++ /dev/null @@ -1,106 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mysql_test_run_new" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=mysql_test_run_new - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mysql_test_run_new.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mysql_test_run_new.mak" CFG="mysql_test_run_new - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mysql_test_run_new - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE "mysql_test_run_new - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mysql_test_run_new - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir ".\Debug" -# PROP BASE Intermediate_Dir ".\Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir ".\Debug" -# PROP Intermediate_Dir ".\Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /I "../include" /I "../" /Z7 /W3 /Od /G6 /D "_DEBUG" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /Fp".\Debug/mysql_test_run_new.pch" /Fo".\Debug/" /Fd".\Debug/" /GZ /FD /c /GX -# ADD CPP /nologo /MTd /I "../include" /I "../" /Z7 /W3 /Od /G6 /D "_DEBUG" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /Fp".\Debug/mysql_test_run_new.pch" /Fo".\Debug/" /Fd".\Debug/" /GZ /FD /c /GX -# ADD BASE MTL /nologo /tlb".\Debug\mysql_test_run_new.tlb" /win32 -# ADD MTL /nologo /tlb".\Debug\mysql_test_run_new.tlb" /win32 -# ADD BASE RSC /l 1033 -# ADD RSC /l 1033 -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /out:"..\mysql-test\mysql_test_run_new.exe" /incremental:yes /debug /pdb:".\Debug\mysql_test_run_new.pdb" /pdbtype:sept /map:".\Debug\mysql_test_run_new.map" /subsystem:console -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib zlib.lib /nologo /out:"..\mysql-test\mysql_test_run_new.exe" /incremental:yes /libpath:"..\lib_debug\" /debug /pdb:".\Debug\mysql_test_run_new.pdb" /pdbtype:sept /map:".\Debug\mysql_test_run_new.map" /subsystem:console - -!ELSEIF "$(CFG)" == "mysql_test_run_new - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir ".\Release" -# PROP BASE Intermediate_Dir ".\Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir ".\Release" -# PROP Intermediate_Dir ".\Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /I "../include" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /GF /Gy /Fp".\Release/mysql_test_run_new.pch" /Fo".\Release/" /Fd".\Release/" /FD /c /GX -# ADD CPP /nologo /MTd /I "../include" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /GF /Gy /Fp".\Release/mysql_test_run_new.pch" /Fo".\Release/" /Fd".\Release/" /FD /c /GX -# ADD BASE MTL /nologo /tlb".\Release\mysql_test_run_new.tlb" /win32 -# ADD MTL /nologo /tlb".\Release\mysql_test_run_new.tlb" /win32 -# ADD BASE RSC /l 1033 -# ADD RSC /l 1033 -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /out:"..\mysql-test\mysql_test_run_new.exe" /incremental:no /pdb:".\Release\mysql_test_run_new.pdb" /pdbtype:sept /subsystem:console -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib zlib.lib /nologo /out:"..\mysql-test\mysql_test_run_new.exe" /incremental:no /libpath:"..\lib_release\" /pdb:".\Release\mysql_test_run_new.pdb" /pdbtype:sept /subsystem:console - -!ENDIF - -# Begin Target - -# Name "mysql_test_run_new - Win32 Debug" -# Name "mysql_test_run_new - Win32 Release" -# Begin Source File - -SOURCE=.\my_create_tables.c -# End Source File -# Begin Source File - -SOURCE=.\my_manage.c -# End Source File -# Begin Source File - -SOURCE=.\my_manage.h -# End Source File -# Begin Source File - -SOURCE=.\mysql_test_run_new.c -# End Source File -# End Target -# End Project - diff --git a/VC++Files/mysql-test/mysql_test_run_new.vcproj b/VC++Files/mysql-test/mysql_test_run_new.vcproj deleted file mode 100644 index 12d502e5768..00000000000 --- a/VC++Files/mysql-test/mysql_test_run_new.vcproj +++ /dev/null @@ -1,204 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/VC++Files/mysql-test/mysql_test_run_new_ia64.dsp b/VC++Files/mysql-test/mysql_test_run_new_ia64.dsp deleted file mode 100644 index 023b38bd3c6..00000000000 --- a/VC++Files/mysql-test/mysql_test_run_new_ia64.dsp +++ /dev/null @@ -1,142 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mysql_test_run_new" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=mysql_test_run_new - WinIA64 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mysql_test_run_new_ia64.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mysql_test_run_new_ia64.mak" CFG="mysql_test_run_new - WinIA64 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mysql_test_run_new - WinIA64 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE "mysql_test_run_new - WinIA64 Release" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mysql_test_run_new - WinIA64 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir ".\Debug" -# PROP BASE Intermediate_Dir ".\Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir ".\Debug" -# PROP Intermediate_Dir ".\Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -MTL=midl.exe -# ADD BASE MTL /nologo /tlb".\Debug\mysql_test_run_new.tlb" /WinIA64 -# ADD MTL /nologo /tlb".\Debug\mysql_test_run_new.tlb" /WinIA64 -# ADD BASE CPP /nologo /G6 /MTd /W3 /GX /Z7 /Od /I "../include" /I "../" /D "_DEBUG" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN64" /GZ /c -# ADD CPP /nologo /MTd /W3 /Zi /Od /I "../include" /I "../" /D "_DEBUG" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN64" /D "_IA64_" /D "WIN64" /D "WIN32" /D "_AFX_NO_DAO_SUPPORT" /GZ /G2 /EHsc /Wp64 /Zm600 /c -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /subsystem:console /map /debug /out:"..\mysql-test\mysql_test_run_new.exe" /machine:IA64 -# SUBTRACT BASE LINK32 /pdb:none -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Ws2_32.lib bufferoverflowU.lib zlib.lib /nologo /subsystem:console /incremental:no /libpath:"..\lib_debug\" /map /debug /out:"..\mysql-test\mysql_test_run_new.exe" /machine:IA64 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "mysql_test_run_new - WinIA64 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir ".\Release" -# PROP BASE Intermediate_Dir ".\Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir ".\Release" -# PROP Intermediate_Dir ".\Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -MTL=midl.exe -# ADD BASE MTL /nologo /tlb".\Release\mysql_test_run_new.tlb" /WinIA64 -# ADD MTL /nologo /tlb".\Release\mysql_test_run_new.tlb" /WinIA64 -# ADD BASE CPP /nologo /G6 /MTd /W3 /GX /Ob1 /Gy /I "../include" /I "../" /D "DBUG_OFF" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN64" /GF /c -# ADD CPP /nologo /MTd /W3 /Zi /O2 /I "../include" /I "../" /D "DBUG_OFF" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN64" /D "_IA64_" /D "WIN64" /D "WIN32" /D "_AFX_NO_DAO_SUPPORT" /GF /G2 /EHsc /Wp64 /Zm600 /c -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /subsystem:console /out:"..\mysql-test\mysql_test_run_new.exe" /machine:IA64 -# SUBTRACT BASE LINK32 /pdb:none -# ADD LINK32 t kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Ws2_32.lib bufferoverflowU.lib zlib.lib /nologo /subsystem:console /libpath:"..\lib_release\" /out:"..\mysql-test\mysql_test_run_new.exe" /machine:IA64 -# SUBTRACT LINK32 /pdb:none - -!ENDIF - -# Begin Target - -# Name "mysql_test_run_new - WinIA64 Debug" -# Name "mysql_test_run_new - WinIA64 Release" -# Begin Source File - -SOURCE=.\my_create_tables.c -DEP_CPP_MY_CR=\ - "..\include\config-netware.h"\ - "..\include\config-os2.h"\ - "..\include\config-win.h"\ - "..\include\m_string.h"\ - "..\include\my_config.h"\ - "..\include\my_dbug.h"\ - "..\include\my_global.h"\ - ".\my_manage.h"\ - -# End Source File -# Begin Source File - -SOURCE=.\my_manage.c -DEP_CPP_MY_MA=\ - "..\include\config-netware.h"\ - "..\include\config-os2.h"\ - "..\include\config-win.h"\ - "..\include\m_string.h"\ - "..\include\my_config.h"\ - "..\include\my_dbug.h"\ - "..\include\my_global.h"\ - ".\my_manage.h"\ - -# End Source File -# Begin Source File - -SOURCE=.\my_manage.h -# End Source File -# Begin Source File - -SOURCE=.\mysql_test_run_new.c -DEP_CPP_MYSQL=\ - "..\include\config-netware.h"\ - "..\include\config-os2.h"\ - "..\include\config-win.h"\ - "..\include\m_string.h"\ - "..\include\my_config.h"\ - "..\include\my_dbug.h"\ - "..\include\my_global.h"\ - ".\my_manage.h"\ - -# End Source File -# End Target -# End Project diff --git a/VC++Files/mysql.dsw b/VC++Files/mysql.dsw index 911b895c1ad..f69719bf21e 100644 --- a/VC++Files/mysql.dsw +++ b/VC++Files/mysql.dsw @@ -808,28 +808,6 @@ Project: "mysql_client_test"=.\tests\mysql_client_test.dsp - Package Owner=<4> {{{ }}} - ############################################################################### - - -Project: "mysql_test_run_new"=".\mysql-test\mysql_test_run_new.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ Begin Project Dependency - Project_Dep_Name mysqltest - End Project Dependency - Begin Project Dependency - Project_Dep_Name mysqladmin - End Project Dependency - Begin Project Dependency - Project_Dep_Name mysql_client_test - End Project Dependency -}}} - - ############################################################################### Global: diff --git a/VC++Files/mysql.sln b/VC++Files/mysql.sln index 1e3a33b8eb4..0d4f22862a3 100644 --- a/VC++Files/mysql.sln +++ b/VC++Files/mysql.sln @@ -281,13 +281,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysql_client_test", "tests\ {44D9C7DC-6636-4B82-BD01-6876C64017DF} = {44D9C7DC-6636-4B82-BD01-6876C64017DF} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysql_test_run_new", "mysql-test\mysql_test_run_new.vcproj", "{6189F838-21C6-42A1-B2D0-9146316573F7}" - ProjectSection(ProjectDependencies) = postProject - {8961F149-C68A-4154-A499-A2AB39E607E8} = {8961F149-C68A-4154-A499-A2AB39E607E8} - {DA224DAB-5006-42BE-BB77-16E8BE5326D5} = {DA224DAB-5006-42BE-BB77-16E8BE5326D5} - {D2B00DE0-F6E9-40AF-B90D-A257D014F098} = {D2B00DE0-F6E9-40AF-B90D-A257D014F098} - EndProjectSection -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysqlmanager", "server-tools\instance-manager\mysqlmanager.vcproj", "{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}" ProjectSection(ProjectDependencies) = postProject {EEC1300B-85A5-497C-B3E1-F708021DF859} = {EEC1300B-85A5-497C-B3E1-F708021DF859} @@ -1467,33 +1460,6 @@ Global {DA224DAB-5006-42BE-BB77-16E8BE5326D5}.pro nt.Build.0 = Release|Win32 {DA224DAB-5006-42BE-BB77-16E8BE5326D5}.Release.ActiveCfg = Release|Win32 {DA224DAB-5006-42BE-BB77-16E8BE5326D5}.Release.Build.0 = Release|Win32 - {6189F838-21C6-42A1-B2D0-9146316573F7}.classic.ActiveCfg = Release|Win32 - {6189F838-21C6-42A1-B2D0-9146316573F7}.classic.Build.0 = Release|Win32 - {6189F838-21C6-42A1-B2D0-9146316573F7}.classic nt.ActiveCfg = Release|Win32 - {6189F838-21C6-42A1-B2D0-9146316573F7}.classic nt.Build.0 = Release|Win32 - {6189F838-21C6-42A1-B2D0-9146316573F7}.Debug.ActiveCfg = Debug|Win32 - {6189F838-21C6-42A1-B2D0-9146316573F7}.Debug.Build.0 = Debug|Win32 - {6189F838-21C6-42A1-B2D0-9146316573F7}.Embedded_Classic.ActiveCfg = Release|Win32 - {6189F838-21C6-42A1-B2D0-9146316573F7}.Embedded_Debug.ActiveCfg = Debug|Win32 - {6189F838-21C6-42A1-B2D0-9146316573F7}.Embedded_Pro.ActiveCfg = Release|Win32 - {6189F838-21C6-42A1-B2D0-9146316573F7}.Embedded_ProGPL.ActiveCfg = Release|Win32 - {6189F838-21C6-42A1-B2D0-9146316573F7}.Embedded_Release.ActiveCfg = Release|Win32 - {6189F838-21C6-42A1-B2D0-9146316573F7}.Max.ActiveCfg = Release|Win32 - {6189F838-21C6-42A1-B2D0-9146316573F7}.Max.Build.0 = Release|Win32 - {6189F838-21C6-42A1-B2D0-9146316573F7}.Max nt.ActiveCfg = Release|Win32 - {6189F838-21C6-42A1-B2D0-9146316573F7}.Max nt.Build.0 = Release|Win32 - {6189F838-21C6-42A1-B2D0-9146316573F7}.nt.ActiveCfg = Release|Win32 - {6189F838-21C6-42A1-B2D0-9146316573F7}.nt.Build.0 = Release|Win32 - {6189F838-21C6-42A1-B2D0-9146316573F7}.pro.ActiveCfg = Release|Win32 - {6189F838-21C6-42A1-B2D0-9146316573F7}.pro.Build.0 = Release|Win32 - {6189F838-21C6-42A1-B2D0-9146316573F7}.pro gpl.ActiveCfg = Release|Win32 - {6189F838-21C6-42A1-B2D0-9146316573F7}.pro gpl.Build.0 = Release|Win32 - {6189F838-21C6-42A1-B2D0-9146316573F7}.pro gpl nt.ActiveCfg = Release|Win32 - {6189F838-21C6-42A1-B2D0-9146316573F7}.pro gpl nt.Build.0 = Release|Win32 - {6189F838-21C6-42A1-B2D0-9146316573F7}.pro nt.ActiveCfg = Release|Win32 - {6189F838-21C6-42A1-B2D0-9146316573F7}.pro nt.Build.0 = Release|Win32 - {6189F838-21C6-42A1-B2D0-9146316573F7}.Release.ActiveCfg = Release|Win32 - {6189F838-21C6-42A1-B2D0-9146316573F7}.Release.Build.0 = Release|Win32 {6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}.classic.ActiveCfg = Release|Win32 {6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}.classic.Build.0 = Release|Win32 {6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}.classic nt.ActiveCfg = Release|Win32 diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am index cd668950459..ed85f06fcc5 100644 --- a/mysql-test/Makefile.am +++ b/mysql-test/Makefile.am @@ -46,8 +46,6 @@ CLEANFILES = $(GENSCRIPTS) $(test_DATA) INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I.. -noinst_HEADERS = my_manage.h - dist-hook: mkdir -p $(distdir)/t $(distdir)/r $(distdir)/include \ $(distdir)/std_data $(distdir)/lib diff --git a/mysql-test/my_create_tables.c b/mysql-test/my_create_tables.c deleted file mode 100644 index 0f6691b91b7..00000000000 --- a/mysql-test/my_create_tables.c +++ /dev/null @@ -1,688 +0,0 @@ -/* Copyright (C) 2004-2005 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#include -#include -#ifndef __WIN__ -#include -#endif -#include -#ifdef __NETWARE__ -#include -#include -#else -#include -#ifndef __WIN__ -#include -#include -#else -#include -#include -#include -#endif -#endif -#include -#include -#include -#include -#include "my_manage.h" - -/* - Synopsis: - This function testes a exist file - -Arguments: - mdata: path to data - file_name: name of file -Output: - A zero value indicates that file is exist. -*/ -bool test_sys_file(const char *mdata,const char *file_name) -{ - struct stat file; - char path_file_name[PATH_MAX]; - snprintf(path_file_name, PATH_MAX, "%s/%s", mdata, file_name); - return(stat(path_file_name,&file)); -} - -/* - Synopsis: - This function creates a file with sql requstes for creating - system data files. - -Arguments: - mdata: path to data - output_file: file name for output file - test: to create system files with test data -Output: - A zero value indicates a success. -*/ -bool create_system_files(const char *mdata,const char *output_file, bool test) -{ - FILE *out; - - out = fopen(output_file, "w+"); - - if (!out) - return 1; - - if (test_sys_file(mdata,"mysql")) - { - fprintf(out,"CREATE DATABASE mysql;\n"); - } - - if (test && test_sys_file(mdata,"test")) - { - fprintf(out,"CREATE DATABASE test;\n"); - } - - fprintf(out,"USE mysql;\n"); - - if (test_sys_file(mdata,"mysql/db.frm")) - { - fprintf(out, - "CREATE TABLE db (" - "Host char(60) binary DEFAULT '' NOT NULL," - "Db char(64) binary DEFAULT '' NOT NULL," - "User char(16) binary DEFAULT '' NOT NULL," - "Select_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Update_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Create_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "References_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Index_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "PRIMARY KEY Host (Host,Db,User)," - "KEY User (User))" - "engine=MyISAM " - "CHARACTER SET utf8 COLLATE utf8_bin " - "comment='Database privileges';\n"); - - if (test) - { - fprintf(out,"INSERT INTO db VALUES ('%%','test','','Y','Y','Y','Y'" - ",'Y','Y','N','Y','Y','Y','Y','Y');\n"); - fprintf(out,"INSERT INTO db VALUES ('%%','test\\_%%','','Y','Y','Y'" - ",'Y','Y','Y','N','Y','Y','Y','Y','Y');\n"); - } - } - - if (test_sys_file(mdata,"mysql/host.frm")) - { - fprintf(out, - "CREATE TABLE host (" - "Host char(60) binary DEFAULT '' NOT NULL," - "Db char(64) binary DEFAULT '' NOT NULL," - "Select_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Update_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Create_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "References_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Index_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "PRIMARY KEY Host (Host,Db))" - "engine=MyISAM " - "CHARACTER SET utf8 COLLATE utf8_bin " - "comment='Host privileges; Merged with database privileges';\n"); - } - - - if (test_sys_file(mdata,"mysql/user.frm")) - { -#ifdef __WIN__ - WSADATA wsa_data; -#endif - char hostname[FN_REFLEN]; - -#ifdef __WIN__ - if (WSAStartup(MAKEWORD( 2, 2 ),&wsa_data)) - return 1; -#endif - if (gethostname(hostname, FN_REFLEN)) - return 1; -#ifdef __WIN__ - WSACleanup( ); -#endif - - if (strchr(hostname, '.') == NULL) - strcat(hostname, "%"); - - fprintf(out, - "CREATE TABLE user (" - "Host char(60) binary DEFAULT '' NOT NULL," - "User char(16) binary DEFAULT '' NOT NULL," - "Password char(41) binary DEFAULT '' NOT NULL," - "Select_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Update_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Create_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Process_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "File_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "References_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Index_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Super_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "ssl_type enum('','ANY','X509', 'SPECIFIED') DEFAULT '' NOT NULL," - "ssl_cipher BLOB NOT NULL," - "x509_issuer BLOB NOT NULL," - "x509_subject BLOB NOT NULL," - "max_questions int(11) unsigned DEFAULT 0 NOT NULL," - "max_updates int(11) unsigned DEFAULT 0 NOT NULL," - "max_connections int(11) unsigned DEFAULT 0 NOT NULL," - "PRIMARY KEY Host (Host,User)" - ") engine=MyISAM " - "CHARACTER SET utf8 COLLATE utf8_bin " - "comment='Users and global privileges';\n"); - - - if (test) - { - fprintf(out, - "INSERT INTO user VALUES ('localhost','root',''" - ",'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'" - ",'Y','Y','Y','Y','Y','','','','',0,0,0);\n"); - fprintf(out, - "INSERT INTO user VALUES ('%s','root','','Y','Y'," - "'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'," - "'Y','Y','Y','Y','','','','',0,0,0);\n",hostname); - fprintf(out, - "REPLACE INTO user VALUES ('127.0.0.1','root',''," - "'Y','Y','Y','Y','Y','Y'," - "'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'" - ",'Y','','','','',0,0,0);\n"); - fprintf(out,"INSERT INTO user (host,user) values ('localhost','');\n"); - fprintf(out,"INSERT INTO user (host,user) values ('%s','');\n",hostname); - } - else - { - fprintf(out, - "INSERT INTO user VALUES ('localhost','root',''," - "'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'," - "'Y','Y','Y','Y','','','','',0,0,0);\n"); -#ifndef __WIN__ - fprintf(out, - "INSERT INTO user VALUES ('%s','root','','Y','Y'," - "'Y','Y','Y','Y','Y','Y'" - "'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','',''" - ",'','',0,0,0);\n",hostname); - fprintf(out,"INSERT INTO user (host,user) values ('%s','');\n",hostname); - fprintf(out,"INSERT INTO user (host,user) values ('localhost','');\n"); -#else - fprintf(out, - "INSERT INTO user VALUES ('localhost','','','Y','Y','Y'" - ",'Y','Y','Y','Y','Y','Y'" - ",'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','',''," - "'','',0,0,0);\n"); -#endif - } - } - - - if (test_sys_file(mdata,"mysql/func.frm")) - { - fprintf(out, - "CREATE TABLE func (" - "name char(64) binary DEFAULT '' NOT NULL," - "ret tinyint(1) DEFAULT '0' NOT NULL," - "dl char(128) DEFAULT '' NOT NULL," - "type enum ('function','aggregate') NOT NULL," - "PRIMARY KEY (name)" - ") engine=MyISAM " - "CHARACTER SET utf8 COLLATE utf8_bin " - "comment='User defined functions';\n"); - } - - if (test_sys_file(mdata,"mysql/tables_priv.frm")) - { - fprintf(out, - "CREATE TABLE tables_priv (" - "Host char(60) binary DEFAULT '' NOT NULL," - "Db char(64) binary DEFAULT '' NOT NULL," - "User char(16) binary DEFAULT '' NOT NULL," - "Table_name char(64) binary DEFAULT '' NOT NULL," - "Grantor char(77) DEFAULT '' NOT NULL," - "Timestamp timestamp(14)," - "Table_priv set('Select','Insert','Update','Delete'," - "'Create','Drop','Grant','References','Index','Alter')" - " DEFAULT '' NOT NULL," - "Column_priv set('Select','Insert','Update','References')" - " DEFAULT '' NOT NULL," - "PRIMARY KEY (Host,Db,User,Table_name)," - "KEY Grantor (Grantor)" - ") engine=MyISAM " - "CHARACTER SET utf8 COLLATE utf8_bin " - "comment='Table privileges';\n"); - } - - if (test_sys_file(mdata,"mysql/columns_priv.frm")) - { - fprintf(out, - "CREATE TABLE columns_priv (" - "Host char(60) binary DEFAULT '' NOT NULL," - "Db char(64) binary DEFAULT '' NOT NULL," - "User char(16) binary DEFAULT '' NOT NULL," - "Table_name char(64) binary DEFAULT '' NOT NULL," - "Column_name char(64) binary DEFAULT '' NOT NULL," - "Timestamp timestamp(14)," - "Column_priv set('Select','Insert','Update','References')" - " DEFAULT '' NOT NULL," - "PRIMARY KEY (Host,Db,User,Table_name,Column_name)" - ") engine=MyISAM " - "CHARACTER SET utf8 COLLATE utf8_bin " - "comment='Column privileges';\n"); - } - - if (test_sys_file(mdata,"mysql/help_topic.frm")) - { - fprintf(out, - "CREATE TABLE help_topic (" - "help_topic_id int unsigned not null," - "name varchar(64) not null," - "help_category_id smallint unsigned not null," - "description text not null," - "example text not null," - "url varchar(128) not null," - "primary key (help_topic_id)," - "unique index (name)" - ") engine=MyISAM " - "CHARACTER SET utf8 " - "comment='help topics';\n"); - } - - if (test_sys_file(mdata,"mysql/help_category.frm")) - { - fprintf(out, - "CREATE TABLE help_category (" - "help_category_id smallint unsigned not null," - "name varchar(64) not null," - "parent_category_id smallint unsigned null," - "url varchar(128) not null," - "primary key (help_category_id)," - "unique index (name)" - ") engine=MyISAM " - "CHARACTER SET utf8 " - "comment='help categories';\n"); - } - - if (test_sys_file(mdata,"mysql/help_keyword.frm")) - { - fprintf(out, - "CREATE TABLE help_keyword (" - "help_keyword_id int unsigned not null," - "name varchar(64) not null," - "primary key (help_keyword_id)," - "unique index (name)" - ") engine=MyISAM " - "CHARACTER SET utf8 " - "comment='help keywords';\n"); - } - - if (test_sys_file(mdata,"mysql/help_relation.frm")) - { - fprintf(out, - "CREATE TABLE help_relation (" - "help_topic_id int unsigned not null references help_topic," - "help_keyword_id int unsigned not null references help_keyword," - "primary key (help_keyword_id, help_topic_id)" - ") engine=MyISAM " - "CHARACTER SET utf8 " - "comment='keyword-topic relation';\n"); - } - - if (test_sys_file(mdata,"mysql/time_zone_name.frm")) - { - fprintf(out, - "CREATE TABLE time_zone_name (" - "Name char(64) NOT NULL," - "Time_zone_id int unsigned NOT NULL," - "PRIMARY KEY Name (Name)" - ") engine=MyISAM CHARACTER SET utf8 " - "comment='Time zone names';\n"); - - if (test) - { - fprintf(out, - "INSERT INTO time_zone_name (Name, Time_Zone_id) VALUES" - "('MET', 1), ('UTC', 2), ('Universal', 2), " - "('Europe/Moscow',3), ('leap/Europe/Moscow',4)," - "('Japan', 5);\n"); - - } - } - - - if (test_sys_file(mdata,"mysql/time_zone.frm")) - { - fprintf(out, - "CREATE TABLE time_zone (" - "Time_zone_id int unsigned NOT NULL auto_increment," - "Use_leap_seconds enum('Y','N') DEFAULT 'N' NOT NULL," - "PRIMARY KEY TzId (Time_zone_id)" - ") engine=MyISAM CHARACTER SET utf8 " - "comment='Time zones';\n"); - - if (test) - { - fprintf(out,"INSERT INTO time_zone (Time_zone_id, Use_leap_seconds)" - "VALUES (1,'N'), (2,'N'), (3,'N'), (4,'Y'), (5,'N');\n"); - } - } - - if (test_sys_file(mdata,"mysql/time_zone_transition.frm")) - { - fprintf(out, - "CREATE TABLE time_zone_transition (" - "Time_zone_id int unsigned NOT NULL," - "Transition_time bigint signed NOT NULL," - "Transition_type_id int unsigned NOT NULL," - "PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time)" - ") engine=MyISAM CHARACTER SET utf8 " - "comment='Time zone transitions';\n"); - - if (test) - { - fprintf(out, - "INSERT INTO time_zone_transition" - "(Time_zone_id, Transition_time, Transition_type_id)" - "VALUES" - " (1, -1693706400, 0) ,(1, -1680483600, 1)" - ",(1, -1663455600, 2) ,(1, -1650150000, 3)" - ",(1, -1632006000, 2) ,(1, -1618700400, 3)" - ",(1, -938905200, 2) ,(1, -857257200, 3)" - ",(1, -844556400, 2) ,(1, -828226800, 3)" - ",(1, -812502000, 2) ,(1, -796777200, 3)" - ",(1, 228877200, 2) ,(1, 243997200, 3)" - ",(1, 260326800, 2) ,(1, 276051600, 3)" - ",(1, 291776400, 2) ,(1, 307501200, 3)" - ",(1, 323830800, 2) ,(1, 338950800, 3)" - ",(1, 354675600, 2) ,(1, 370400400, 3)" - ",(1, 386125200, 2) ,(1, 401850000, 3)" - ",(1, 417574800, 2) ,(1, 433299600, 3)" - ",(1, 449024400, 2) ,(1, 465354000, 3)" - ",(1, 481078800, 2) ,(1, 496803600, 3)" - ",(1, 512528400, 2) ,(1, 528253200, 3)" - ",(1, 543978000, 2) ,(1, 559702800, 3)" - ",(1, 575427600, 2) ,(1, 591152400, 3)" - ",(1, 606877200, 2) ,(1, 622602000, 3)" - ",(1, 638326800, 2) ,(1, 654656400, 3)" - ",(1, 670381200, 2) ,(1, 686106000, 3)" - ",(1, 701830800, 2) ,(1, 717555600, 3)" - ",(1, 733280400, 2) ,(1, 749005200, 3)" - ",(1, 764730000, 2) ,(1, 780454800, 3)" - ",(1, 796179600, 2) ,(1, 811904400, 3)" - ",(1, 828234000, 2) ,(1, 846378000, 3)" - ",(1, 859683600, 2) ,(1, 877827600, 3)" - ",(1, 891133200, 2) ,(1, 909277200, 3)" - ",(1, 922582800, 2) ,(1, 941331600, 3)" - ",(1, 954032400, 2) ,(1, 972781200, 3)" - ",(1, 985482000, 2) ,(1, 1004230800, 3)" - ",(1, 1017536400, 2) ,(1, 1035680400, 3)" - ",(1, 1048986000, 2) ,(1, 1067130000, 3)" - ",(1, 1080435600, 2) ,(1, 1099184400, 3)" - ",(1, 1111885200, 2) ,(1, 1130634000, 3)" - ",(1, 1143334800, 2) ,(1, 1162083600, 3)" - ",(1, 1174784400, 2) ,(1, 1193533200, 3)" - ",(1, 1206838800, 2) ,(1, 1224982800, 3)" - ",(1, 1238288400, 2) ,(1, 1256432400, 3)" - ",(1, 1269738000, 2) ,(1, 1288486800, 3)" - ",(1, 1301187600, 2) ,(1, 1319936400, 3)" - ",(1, 1332637200, 2) ,(1, 1351386000, 3)" - ",(1, 1364691600, 2) ,(1, 1382835600, 3)" - ",(1, 1396141200, 2) ,(1, 1414285200, 3)" - ",(1, 1427590800, 2) ,(1, 1445734800, 3)" - ",(1, 1459040400, 2) ,(1, 1477789200, 3)" - ",(1, 1490490000, 2) ,(1, 1509238800, 3)" - ",(1, 1521939600, 2) ,(1, 1540688400, 3)" - ",(1, 1553994000, 2) ,(1, 1572138000, 3)" - ",(1, 1585443600, 2) ,(1, 1603587600, 3)" - ",(1, 1616893200, 2) ,(1, 1635642000, 3)" - ",(1, 1648342800, 2) ,(1, 1667091600, 3)" - ",(1, 1679792400, 2) ,(1, 1698541200, 3)" - ",(1, 1711846800, 2) ,(1, 1729990800, 3)" - ",(1, 1743296400, 2) ,(1, 1761440400, 3)" - ",(1, 1774746000, 2) ,(1, 1792890000, 3)" - ",(1, 1806195600, 2) ,(1, 1824944400, 3)" - ",(1, 1837645200, 2) ,(1, 1856394000, 3)" - ",(1, 1869094800, 2) ,(1, 1887843600, 3)" - ",(1, 1901149200, 2) ,(1, 1919293200, 3)" - ",(1, 1932598800, 2) ,(1, 1950742800, 3)" - ",(1, 1964048400, 2) ,(1, 1982797200, 3)" - ",(1, 1995498000, 2) ,(1, 2014246800, 3)" - ",(1, 2026947600, 2) ,(1, 2045696400, 3)" - ",(1, 2058397200, 2) ,(1, 2077146000, 3)" - ",(1, 2090451600, 2) ,(1, 2108595600, 3)" - ",(1, 2121901200, 2) ,(1, 2140045200, 3)" - ",(3, -1688265000, 2) ,(3, -1656819048, 1)" - ",(3, -1641353448, 2) ,(3, -1627965048, 3)" - ",(3, -1618716648, 1) ,(3, -1596429048, 3)" - ",(3, -1593829848, 5) ,(3, -1589860800, 4)" - ",(3, -1542427200, 5) ,(3, -1539493200, 6)" - ",(3, -1525323600, 5) ,(3, -1522728000, 4)" - ",(3, -1491188400, 7) ,(3, -1247536800, 4)" - ",(3, 354920400, 5) ,(3, 370728000, 4)" - ",(3, 386456400, 5) ,(3, 402264000, 4)" - ",(3, 417992400, 5) ,(3, 433800000, 4)" - ",(3, 449614800, 5) ,(3, 465346800, 8)" - ",(3, 481071600, 9) ,(3, 496796400, 8)" - ",(3, 512521200, 9) ,(3, 528246000, 8)" - ",(3, 543970800, 9) ,(3, 559695600, 8)" - ",(3, 575420400, 9) ,(3, 591145200, 8)" - ",(3, 606870000, 9) ,(3, 622594800, 8)" - ",(3, 638319600, 9) ,(3, 654649200, 8)" - ",(3, 670374000, 10) ,(3, 686102400, 11)" - ",(3, 695779200, 8) ,(3, 701812800, 5)" - ",(3, 717534000, 4) ,(3, 733273200, 9)" - ",(3, 748998000, 8) ,(3, 764722800, 9)" - ",(3, 780447600, 8) ,(3, 796172400, 9)" - ",(3, 811897200, 8) ,(3, 828226800, 9)" - ",(3, 846370800, 8) ,(3, 859676400, 9)" - ",(3, 877820400, 8) ,(3, 891126000, 9)" - ",(3, 909270000, 8) ,(3, 922575600, 9)" - ",(3, 941324400, 8) ,(3, 954025200, 9)" - ",(3, 972774000, 8) ,(3, 985474800, 9)" - ",(3, 1004223600, 8) ,(3, 1017529200, 9)" - ",(3, 1035673200, 8) ,(3, 1048978800, 9)" - ",(3, 1067122800, 8) ,(3, 1080428400, 9)" - ",(3, 1099177200, 8) ,(3, 1111878000, 9)" - ",(3, 1130626800, 8) ,(3, 1143327600, 9)" - ",(3, 1162076400, 8) ,(3, 1174777200, 9)" - ",(3, 1193526000, 8) ,(3, 1206831600, 9)" - ",(3, 1224975600, 8) ,(3, 1238281200, 9)" - ",(3, 1256425200, 8) ,(3, 1269730800, 9)" - ",(3, 1288479600, 8) ,(3, 1301180400, 9)" - ",(3, 1319929200, 8) ,(3, 1332630000, 9)" - ",(3, 1351378800, 8) ,(3, 1364684400, 9)" - ",(3, 1382828400, 8) ,(3, 1396134000, 9)" - ",(3, 1414278000, 8) ,(3, 1427583600, 9)" - ",(3, 1445727600, 8) ,(3, 1459033200, 9)" - ",(3, 1477782000, 8) ,(3, 1490482800, 9)" - ",(3, 1509231600, 8) ,(3, 1521932400, 9)" - ",(3, 1540681200, 8) ,(3, 1553986800, 9)" - ",(3, 1572130800, 8) ,(3, 1585436400, 9)" - ",(3, 1603580400, 8) ,(3, 1616886000, 9)" - ",(3, 1635634800, 8) ,(3, 1648335600, 9)" - ",(3, 1667084400, 8) ,(3, 1679785200, 9)" - ",(3, 1698534000, 8) ,(3, 1711839600, 9)" - ",(3, 1729983600, 8) ,(3, 1743289200, 9)" - ",(3, 1761433200, 8) ,(3, 1774738800, 9)" - ",(3, 1792882800, 8) ,(3, 1806188400, 9)" - ",(3, 1824937200, 8) ,(3, 1837638000, 9)" - ",(3, 1856386800, 8) ,(3, 1869087600, 9)" - ",(3, 1887836400, 8) ,(3, 1901142000, 9)" - ",(3, 1919286000, 8) ,(3, 1932591600, 9)" - ",(3, 1950735600, 8) ,(3, 1964041200, 9)" - ",(3, 1982790000, 8) ,(3, 1995490800, 9)" - ",(3, 2014239600, 8) ,(3, 2026940400, 9)" - ",(3, 2045689200, 8) ,(3, 2058390000, 9)" - ",(3, 2077138800, 8) ,(3, 2090444400, 9)" - ",(3, 2108588400, 8) ,(3, 2121894000, 9)" - ",(3, 2140038000, 8)" - ",(4, -1688265000, 2) ,(4, -1656819048, 1)" - ",(4, -1641353448, 2) ,(4, -1627965048, 3)" - ",(4, -1618716648, 1) ,(4, -1596429048, 3)" - ",(4, -1593829848, 5) ,(4, -1589860800, 4)" - ",(4, -1542427200, 5) ,(4, -1539493200, 6)" - ",(4, -1525323600, 5) ,(4, -1522728000, 4)" - ",(4, -1491188400, 7) ,(4, -1247536800, 4)" - ",(4, 354920409, 5) ,(4, 370728010, 4)" - ",(4, 386456410, 5) ,(4, 402264011, 4)" - ",(4, 417992411, 5) ,(4, 433800012, 4)" - ",(4, 449614812, 5) ,(4, 465346812, 8)" - ",(4, 481071612, 9) ,(4, 496796413, 8)" - ",(4, 512521213, 9) ,(4, 528246013, 8)" - ",(4, 543970813, 9) ,(4, 559695613, 8)" - ",(4, 575420414, 9) ,(4, 591145214, 8)" - ",(4, 606870014, 9) ,(4, 622594814, 8)" - ",(4, 638319615, 9) ,(4, 654649215, 8)" - ",(4, 670374016, 10) ,(4, 686102416, 11)" - ",(4, 695779216, 8) ,(4, 701812816, 5)" - ",(4, 717534017, 4) ,(4, 733273217, 9)" - ",(4, 748998018, 8) ,(4, 764722818, 9)" - ",(4, 780447619, 8) ,(4, 796172419, 9)" - ",(4, 811897219, 8) ,(4, 828226820, 9)" - ",(4, 846370820, 8) ,(4, 859676420, 9)" - ",(4, 877820421, 8) ,(4, 891126021, 9)" - ",(4, 909270021, 8) ,(4, 922575622, 9)" - ",(4, 941324422, 8) ,(4, 954025222, 9)" - ",(4, 972774022, 8) ,(4, 985474822, 9)" - ",(4, 1004223622, 8) ,(4, 1017529222, 9)" - ",(4, 1035673222, 8) ,(4, 1048978822, 9)" - ",(4, 1067122822, 8) ,(4, 1080428422, 9)" - ",(4, 1099177222, 8) ,(4, 1111878022, 9)" - ",(4, 1130626822, 8) ,(4, 1143327622, 9)" - ",(4, 1162076422, 8) ,(4, 1174777222, 9)" - ",(4, 1193526022, 8) ,(4, 1206831622, 9)" - ",(4, 1224975622, 8) ,(4, 1238281222, 9)" - ",(4, 1256425222, 8) ,(4, 1269730822, 9)" - ",(4, 1288479622, 8) ,(4, 1301180422, 9)" - ",(4, 1319929222, 8) ,(4, 1332630022, 9)" - ",(4, 1351378822, 8) ,(4, 1364684422, 9)" - ",(4, 1382828422, 8) ,(4, 1396134022, 9)" - ",(4, 1414278022, 8) ,(4, 1427583622, 9)" - ",(4, 1445727622, 8) ,(4, 1459033222, 9)" - ",(4, 1477782022, 8) ,(4, 1490482822, 9)" - ",(4, 1509231622, 8) ,(4, 1521932422, 9)" - ",(4, 1540681222, 8) ,(4, 1553986822, 9)" - ",(4, 1572130822, 8) ,(4, 1585436422, 9)" - ",(4, 1603580422, 8) ,(4, 1616886022, 9)" - ",(4, 1635634822, 8) ,(4, 1648335622, 9)" - ",(4, 1667084422, 8) ,(4, 1679785222, 9)" - ",(4, 1698534022, 8) ,(4, 1711839622, 9)" - ",(4, 1729983622, 8) ,(4, 1743289222, 9)" - ",(4, 1761433222, 8) ,(4, 1774738822, 9)" - ",(4, 1792882822, 8) ,(4, 1806188422, 9)" - ",(4, 1824937222, 8) ,(4, 1837638022, 9)" - ",(4, 1856386822, 8) ,(4, 1869087622, 9)" - ",(4, 1887836422, 8) ,(4, 1901142022, 9)" - ",(4, 1919286022, 8) ,(4, 1932591622, 9)" - ",(4, 1950735622, 8) ,(4, 1964041222, 9)" - ",(4, 1982790022, 8) ,(4, 1995490822, 9)" - ",(4, 2014239622, 8) ,(4, 2026940422, 9)" - ",(4, 2045689222, 8) ,(4, 2058390022, 9)" - ",(4, 2077138822, 8) ,(4, 2090444422, 9)" - ",(4, 2108588422, 8) ,(4, 2121894022, 9)" - ",(4, 2140038022, 8), (5, -1009875600, 1);\n"); - - - } - } - - if (test_sys_file(mdata,"mysql/time_zone_transition_type.frm")) - { - fprintf(out, - "CREATE TABLE time_zone_transition_type (" - "Time_zone_id int unsigned NOT NULL," - "Transition_type_id int unsigned NOT NULL," - "Offset int signed DEFAULT 0 NOT NULL," - "Is_DST tinyint unsigned DEFAULT 0 NOT NULL," - "Abbreviation char(8) DEFAULT '' NOT NULL," - "PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id)" - ") engine=MyISAM CHARACTER SET utf8 " - "comment='Time zone transition types';\n"); - - if (test) - { - fprintf(out, - "INSERT INTO time_zone_transition_type (Time_zone_id," - "Transition_type_id, Offset, Is_DST, Abbreviation) VALUES" - "(1, 0, 7200, 1, 'MEST') ,(1, 1, 3600, 0, 'MET')" - ",(1, 2, 7200, 1, 'MEST') ,(1, 3, 3600, 0, 'MET')" - ",(2, 0, 0, 0, 'UTC')" - ",(3, 0, 9000, 0, 'MMT') ,(3, 1, 12648, 1, 'MST')" - ",(3, 2, 9048, 0, 'MMT') ,(3, 3, 16248, 1, 'MDST')" - ",(3, 4, 10800, 0, 'MSK') ,(3, 5, 14400, 1, 'MSD')" - ",(3, 6, 18000, 1, 'MSD') ,(3, 7, 7200, 0, 'EET')" - ",(3, 8, 10800, 0, 'MSK') ,(3, 9, 14400, 1, 'MSD')" - ",(3, 10, 10800, 1, 'EEST') ,(3, 11, 7200, 0, 'EET')" - ",(4, 0, 9000, 0, 'MMT') ,(4, 1, 12648, 1, 'MST')" - ",(4, 2, 9048, 0, 'MMT') ,(4, 3, 16248, 1, 'MDST')" - ",(4, 4, 10800, 0, 'MSK') ,(4, 5, 14400, 1, 'MSD')" - ",(4, 6, 18000, 1, 'MSD') ,(4, 7, 7200, 0, 'EET')" - ",(4, 8, 10800, 0, 'MSK') ,(4, 9, 14400, 1, 'MSD')" - ",(4, 10, 10800, 1, 'EEST') ,(4, 11, 7200, 0, 'EET')" - ",(5, 0, 32400, 0, 'CJT') ,(5, 1, 32400, 0, 'JST');\n"); - - } - } - - if (test_sys_file(mdata,"mysql/time_zone_leap_second.frm")) - { - fprintf(out, - "CREATE TABLE time_zone_leap_second (" - "Transition_time bigint signed NOT NULL," - "Correction int signed NOT NULL," - "PRIMARY KEY TranTime (Transition_time)" - ") engine=MyISAM CHARACTER SET utf8 " - "comment='Leap seconds information for time zones';\n"); - - if (test) - { - fprintf(out, - "INSERT INTO time_zone_leap_second " - "(Transition_time, Correction) VALUES " - "(78796800, 1) ,(94694401, 2) ,(126230402, 3)" - ",(157766403, 4) ,(189302404, 5) ,(220924805, 6)" - ",(252460806, 7) ,(283996807, 8) ,(315532808, 9)" - ",(362793609, 10) ,(394329610, 11) ,(425865611, 12)" - ",(489024012, 13) ,(567993613, 14) ,(631152014, 15)" - ",(662688015, 16) ,(709948816, 17) ,(741484817, 18)" - ",(773020818, 19) ,(820454419, 20) ,(867715220, 21)" - ",(915148821, 22);\n"); - } - } - - return fclose(out); -} diff --git a/mysql-test/my_manage.c b/mysql-test/my_manage.c deleted file mode 100644 index e5d1be42f95..00000000000 --- a/mysql-test/my_manage.c +++ /dev/null @@ -1,887 +0,0 @@ -/* - Copyright (c) 2003 Novell, Inc. All Rights Reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include -#ifndef __WIN__ -#include -#endif -#include -#ifdef __NETWARE__ -#include -#include -#else -#include -#ifndef __WIN__ -#include -#include -#include -#include /* FIXME HAVE_FNMATCH_H or something */ -#else -#include -#include -#include -#endif -#endif -#include -#include -#include -#include - -#include "my_manage.h" - -#ifndef __NETWARE__ -#define ASSERT assert -extern char **environ; -#endif - - - -/****************************************************************************** - - macros - -******************************************************************************/ - -/****************************************************************************** - - global variables - -******************************************************************************/ - -/****************************************************************************** - - functions - -******************************************************************************/ - -/****************************************************************************** - - init_args() - - Init an argument list. - -******************************************************************************/ - -void init_args(arg_list_t *al) -{ - ASSERT(al != NULL); - - al->argc= 0; - al->size= ARG_BUF; - al->argv= malloc(al->size * sizeof(char *)); - ASSERT(al->argv != NULL); - - return; -} - -/****************************************************************************** - - add_arg() - - Add an argument to a list. - -******************************************************************************/ - -void add_arg(arg_list_t *al, const char *format, ...) -{ - va_list ap; - char temp[FN_REFLEN]; - - ASSERT(al != NULL); - - /* increase size */ - if (al->argc >= (int)al->size) - { - al->size+= ARG_BUF; - al->argv= realloc(al->argv, al->size * sizeof(char *)); - ASSERT(al->argv != NULL); - } - - if (format) - { - va_start(ap, format); - vsprintf(temp, format, ap); - va_end(ap); - - al->argv[al->argc]= malloc(strlen(temp)+1); - ASSERT(al->argv[al->argc] != NULL); - strcpy(al->argv[al->argc], temp); - - ++(al->argc); - } - else - { - al->argv[al->argc]= NULL; - } - - return; -} - -/****************************************************************************** - - free_args() - - Free an argument list. - -******************************************************************************/ - -void free_args(arg_list_t *al) -{ - int i; - - ASSERT(al != NULL); - - for (i= 0; i < al->argc; i++) - { - ASSERT(al->argv[i] != NULL); - free(al->argv[i]); - al->argv[i]= NULL; - } - - free(al->argv); - al->argc= 0; - al->argv= NULL; - - return; -} - -/****************************************************************************** - - sleep_until_file_deleted() - - Sleep until the given file is no longer found. - -******************************************************************************/ - -#ifndef __WIN__ -int sleep_until_file_deleted(char *pid_file) -#else -int sleep_until_file_deleted(HANDLE pid_file) -#endif -{ - int err= 0; /* Initiate to supress warning */ -#ifndef __WIN__ - struct stat buf; - int i; - - for (i= 0; (i < TRY_MAX) && (err= !stat(pid_file, &buf)); i++) sleep(1); - - if (err != 0) err= errno; -#else - err= (WaitForSingleObject(pid_file, TRY_MAX*1000) == WAIT_TIMEOUT); -#endif - return err; -} - -/****************************************************************************** - - sleep_until_file_exists() - - Sleep until the given file exists. - -******************************************************************************/ - -#ifndef __WIN__ -int sleep_until_file_exists(char *pid_file) -#else -int sleep_until_file_exists(HANDLE pid_file) -#endif -{ - int err= 0; /* Initiate to supress warning */ -#ifndef __WIN__ - struct stat buf; - int i; - - for (i= 0; (i < TRY_MAX) && (err= stat(pid_file, &buf)); i++) sleep(1); - - if (err != 0) err= errno; -#else - err= (WaitForSingleObject(pid_file, TRY_MAX*1000) == WAIT_TIMEOUT); -#endif - return err; -} - -/****************************************************************************** - - wait_for_server_start() - - Wait for the server on the given port to start. - -******************************************************************************/ - -int wait_for_server_start(char *bin_dir __attribute__((unused)), - char *mysqladmin_file, - char *user, char *password, int port,char *tmp_dir) -{ - arg_list_t al; - int err= 0; - char trash[FN_REFLEN]; - - /* mysqladmin file */ - snprintf(trash, FN_REFLEN, "%s/trash.out",tmp_dir); - - /* args */ - init_args(&al); - add_arg(&al, "%s", mysqladmin_file); - add_arg(&al, "--no-defaults"); - add_arg(&al, "--port=%u", port); - add_arg(&al, "--user=%s", user); - add_arg(&al, "--password=%s", password); - add_arg(&al, "--silent"); - add_arg(&al, "--host=localhost"); - -#ifndef __NETWARE__ - add_arg(&al, "--connect_timeout=10"); - add_arg(&al, "-w"); - add_arg(&al, "--protocol=tcp"); -#endif - add_arg(&al, "ping"); - - /* - NetWare does not support the connect timeout in the TCP/IP stack - -- we will try the ping multiple times - */ -#ifndef __WIN__ - { - int i; - for (i= 0; - (i < TRY_MAX) && (err= spawn(mysqladmin_file, &al, TRUE, NULL, - trash, NULL, NULL)); - i++) - sleep(1); - } -#else - err= spawn(mysqladmin_file, &al, TRUE, NULL,trash, NULL, NULL); -#endif - - /* free args */ - free_args(&al); - - return err; -} - -/****************************************************************************** - - spawn() - - Spawn the given path with the given arguments. - -******************************************************************************/ - -#ifdef __NETWARE__ -int spawn(char *path, arg_list_t *al, int join, char *input, - char *output, char *error, char *pid_file) -{ - pid_t pid; - int result= 0; - wiring_t wiring= { FD_UNUSED, FD_UNUSED, FD_UNUSED }; - unsigned long flags= PROC_CURRENT_SPACE | PROC_INHERIT_CWD; - - /* open wiring */ - if (input) - wiring.infd= open(input, O_RDONLY); - - if (output) - wiring.outfd= open(output, O_WRONLY | O_CREAT | O_TRUNC); - - if (error) - wiring.errfd= open(error, O_WRONLY | O_CREAT | O_TRUNC); - - /* procve requires a NULL */ - add_arg(al, NULL); - - /* go */ - pid= procve(path, flags, NULL, &wiring, NULL, NULL, 0, - NULL, (const char **)al->argv); - - /* close wiring */ - if (wiring.infd != -1) - close(wiring.infd); - - if (wiring.outfd != -1) - close(wiring.outfd); - - if (wiring.errfd != -1) - close(wiring.errfd); - - return result; -} -#elif __WIN__ - -int spawn(char *path, arg_list_t *al, int join, char *input, - char *output, char *error, HANDLE *pid) -{ - bool result; - int i; - STARTUPINFO startup_info; - PROCESS_INFORMATION process_information; - DWORD exit_code; - char win_args[1024]= ""; - - /* Skip the first parameter */ - for (i= 1; i < al->argc; i++) - { - ASSERT(al->argv[i] != NULL); - strcat(win_args,al->argv[i]); - strcat(win_args," "); - } - - memset(&startup_info,0,sizeof(STARTUPINFO)); - startup_info.cb= sizeof(STARTUPINFO); - - if (input) - freopen(input, "rb", stdin); - - if (output) - freopen(output, "wb", stdout); - - if (error) - freopen(error, "wb", stderr); - - result= CreateProcess( - path, - (LPSTR)&win_args, - NULL, - NULL, - TRUE, - 0, - NULL, - NULL, - &startup_info, - &process_information - ); - - if (result && process_information.hProcess) - { - if (join) - { - if (WaitForSingleObject(process_information.hProcess, mysqld_timeout) - == WAIT_TIMEOUT) - { - exit_code= -1; - } - else - { - GetExitCodeProcess(process_information.hProcess, &exit_code); - } - CloseHandle(process_information.hProcess); - } - else - { - exit_code= 0; - } - if (pid != NULL) - *pid= process_information.hProcess; - } - else - { - exit_code= -1; - } - if (input) - freopen("CONIN$","rb",stdin); - if (output) - freopen("CONOUT$","wb",stdout); - if (error) - freopen("CONOUT$","wb",stderr); - - return exit_code; -} -#else -int spawn(char *path, arg_list_t *al, int join, char *input, - char *output, char *error, char *pid_file __attribute__((unused))) -{ - pid_t pid; - int res_exec= 0; - int result= 0; - - pid= fork(); - - if (pid == -1) - { - fprintf(stderr, "fork was't created\n"); - /* We can't create the fork...exit with error */ - return EXIT_FAILURE; - } - - if (pid > 0) - { - /* The parent process is waiting for child process if join is not zero */ - if (join) - { - waitpid(pid, &result, 0); - if (WIFEXITED(result) != 0) - { - result= WEXITSTATUS(result); - } - else - { - result= EXIT_FAILURE; - } - } - } - else - { - - /* Child process */ - add_arg(al, NULL); - - /* Reassign streams */ - if (input) - freopen(input, "r", stdin); - - if (output) - freopen(output, "w", stdout); - - if (error) - freopen(error, "w", stderr); - - /* Spawn the process */ - if ((res_exec= execve(path, al->argv, environ)) < 0) - exit(EXIT_FAILURE); - - /* Restore streams */ - if (input) - freopen("/dev/tty", "r", stdin); - - if (output) - freopen("/dev/tty", "w", stdout); - - if (error) - freopen("/dev/tty", "w", stderr); - - exit(0); - } - - return result; -} -#endif -/****************************************************************************** - - stop_server() - - Stop the server with the given port and pid file. - -******************************************************************************/ - -int stop_server(char *bin_dir __attribute__((unused)), char *mysqladmin_file, - char *user, char *password, int port, -#ifndef __WIN__ - char *pid_file, -#else - HANDLE pid_file, -#endif - char *tmp_dir) -{ - arg_list_t al; - int err= 0; - char trash[FN_REFLEN]; - - snprintf(trash, FN_REFLEN, "%s/trash.out",tmp_dir); - - /* args */ - init_args(&al); - add_arg(&al, "%s", mysqladmin_file); - add_arg(&al, "--no-defaults"); - add_arg(&al, "--port=%u", port); - add_arg(&al, "--user=%s", user); - add_arg(&al, "--password=%s", password); - add_arg(&al, "-O"); - add_arg(&al, "shutdown_timeout=20"); -#ifndef __NETWARE__ - add_arg(&al, "--protocol=tcp"); -#endif - add_arg(&al, "shutdown"); - - /* spawn */ - if ((err= spawn(mysqladmin_file, &al, TRUE, NULL, - trash, NULL, NULL)) == 0) - { - sleep_until_file_deleted(pid_file); - } - else - { -#ifndef __WIN__ - pid_t pid= get_server_pid(pid_file); - - /* shutdown failed - kill server */ - kill_server(pid); - - sleep(TRY_MAX); - - /* remove pid file if possible */ - err= remove(pid_file); -#else - TerminateProcess(pid_file,err); -#endif - } - - /* free args */ - free_args(&al); - - return err; -} - -/****************************************************************************** - - get_server_pid() - - Get the VM id with the given pid file. - -******************************************************************************/ - -#ifndef __WIN__ -pid_t get_server_pid(char *pid_file) -{ - char buf[FN_REFLEN]; - int fd, err; - char *p; - pid_t id= 0; - - /* discover id */ - fd= open(pid_file, O_RDONLY); - - err= read(fd, buf, FN_REFLEN); - - close(fd); - - if (err > 0) - { - /* terminate string */ - if ((p= strchr(buf, '\n')) != NULL) - { - *p= '\0'; - - /* check for a '\r' */ - if ((p= strchr(buf, '\r')) != NULL) - { - *p= '\0'; - } - } - else - { - buf[err]= '\0'; - } - - id= strtol(buf, NULL, 0); - } - - return id; -} - -/****************************************************************************** - - kill_server() - - Force a kill of the server with the given pid. - -******************************************************************************/ - -void kill_server(pid_t pid) -{ - if (pid > 0) - { -#if !defined(__NETWARE__) - /* Send SIGTERM to pid */ - kill(pid, SIGTERM); -#else /* __NETWARE__ */ - /* destroy vm */ - NXVmDestroy(pid); -#endif - } -} -#endif -/****************************************************************************** - - del_tree() - - Delete the directory and subdirectories. - -******************************************************************************/ - -void del_tree(char *dir) -{ -#ifndef __WIN__ - DIR *parent= opendir(dir); - struct dirent *entry; - char temp[FN_REFLEN]; - - if (parent == NULL) - { - return; - } - - while ((entry= readdir(parent)) != NULL) - { - /* create long name */ - snprintf(temp, FN_REFLEN, "%s/%s", dir, entry->d_name); - - if (entry->d_name[0] == '.') - { - /* Skip */ - } - else - { -/* FIXME missing test in acinclude.m4 */ -#ifndef STRUCT_DIRENT_HAS_D_TYPE - struct stat st; - - if (lstat(entry->d_name, &st) == -1) - { - /* FIXME error */ - return; - } - if (S_ISDIR(st.st_mode)) -#else - if (S_ISDIR(entry->d_type)) -#endif - { - /* delete subdirectory */ - del_tree(temp); - } - else - { - /* remove file */ - remove(temp); - } - } - } - /* remove directory */ - rmdir(dir); -#else - struct _finddata_t parent; -#if defined(_MSC_VER) && _MSC_VER > 1200 - intptr_t handle; -#else - long handle; -#endif /* _MSC_VER && _MSC_VER > 1200 */ - char temp[FN_REFLEN]; - char mask[FN_REFLEN]; - - snprintf(mask,FN_REFLEN,"%s/*.*",dir); - - if ((handle=_findfirst(mask,&parent)) == -1L) - { - return; - } - - do - { - /* create long name */ - snprintf(temp, FN_REFLEN, "%s/%s", dir, parent.name); - if (parent.name[0] == '.') - { - /* Skip */ - } - else - if (parent.attrib & _A_SUBDIR) - { - /* delete subdirectory */ - del_tree(temp); - } - else - { - /* remove file */ - remove(temp); - } - } while (_findnext(handle,&parent) == 0); - - _findclose(handle); - - /* remove directory */ - _rmdir(dir); -#endif -} - -/****************************************************************************** - - removef() - -******************************************************************************/ - -int removef(const char *format, ...) -{ -#ifdef __NETWARE__ - va_list ap; - char path[FN_REFLEN]; - - va_start(ap, format); - - vsnprintf(path, FN_REFLEN, format, ap); - - va_end(ap); - return remove(path); - -#elif __WIN__ - { - va_list ap; - char path[FN_REFLEN]; - struct _finddata_t parent; -#if defined(_MSC_VER) && _MSC_VER > 1200 - intptr_t handle; -#else - long handle; -#endif /* _MSC_VER && _MSC_VER > 1200 */ - char temp[FN_REFLEN]; - char *p; - - va_start(ap, format); - - vsnprintf(path, FN_REFLEN, format, ap); - - va_end(ap); - - p= path + strlen(path); - while (*p != '\\' && *p != '/' && p > path) p--; - - if ((handle=_findfirst(path,&parent)) == -1L) - { - /* if there is not files....it's ok */ - return 0; - } - - *p= '\0'; - - do - { - if (! (parent.attrib & _A_SUBDIR)) - { - snprintf(temp, FN_REFLEN, "%s/%s", path, parent.name); - remove(temp); - } - }while (_findnext(handle,&parent) == 0); - - _findclose(handle); - } -#else - DIR *parent; - struct dirent *entry; - char temp[FN_REFLEN]; - va_list ap; - char path[FN_REFLEN]; - char *p; - /* Get path with mask */ - va_start(ap, format); - - vsnprintf(path, FN_REFLEN, format, ap); - - va_end(ap); - - p= path + strlen(path); - while (*p != '\\' && *p != '/' && p > path) p--; - *p= '\0'; - p++; - - parent= opendir(path); - - if (parent == NULL) - { - return 1; /* Error, directory missing */ - } - - while ((entry= readdir(parent)) != NULL) - { - /* entry is not directory and entry matches with mask */ -#ifndef STRUCT_DIRENT_HAS_D_TYPE - struct stat st; - - /* create long name */ - snprintf(temp, FN_REFLEN, "%s/%s", path, entry->d_name); - - if (lstat(temp, &st) == -1) - { - return 1; /* Error couldn't lstat file */ - } - - if (!S_ISDIR(st.st_mode) && !fnmatch(p, entry->d_name,0)) -#else - if (!S_ISDIR(entry->d_type) && !fnmatch(p, entry->d_name,0)) -#endif - { - /* create long name */ - snprintf(temp, FN_REFLEN, "%s/%s", path, entry->d_name); - /* Delete only files */ - remove(temp); - } - } -#endif - return 0; -} - -/****************************************************************************** - - get_basedir() - -******************************************************************************/ - -void get_basedir(char *argv0, char *basedir) -{ - char temp[FN_REFLEN]; - char *p; - int position; - - ASSERT(argv0 != NULL); - ASSERT(basedir != NULL); - - strcpy(temp, strlwr(argv0)); - while ((p= strchr(temp, '\\')) != NULL) *p= '/'; - - if ((position= strinstr(temp, "/bin/")) != 0) - { - p= temp + position; - *p= '\0'; - strcpy(basedir, temp); - } -} - -uint strinstr(reg1 const char *str,reg4 const char *search) -{ - reg2 my_string i,j; - my_string start= (my_string) str; - - skipp: - while (*str != '\0') - { - if (*str++ == *search) - { - i=(my_string) str; - j= (my_string) search+1; - while (*j) - if (*i++ != *j++) goto skipp; - return ((uint) (str - start)); - } - } - return (0); -} - -/****************************************************************************** - - remove_empty_file() - -******************************************************************************/ - -void remove_empty_file(const char *file_name) -{ - struct stat file; - - if (!stat(file_name,&file)) - { - if (!file.st_size) - remove(file_name); - } -} diff --git a/mysql-test/my_manage.h b/mysql-test/my_manage.h deleted file mode 100644 index 5df77b01af8..00000000000 --- a/mysql-test/my_manage.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - Copyright (c) 2002 Novell, Inc. All Rights Reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef _MY_MANAGE -#define _MY_MANAGE - -/****************************************************************************** - - includes - -******************************************************************************/ - -#include -#ifndef __WIN__ -#include -#endif -#ifndef __NETWARE__ -#include -#include -#include - -#ifndef __WIN__ -#define strnicmp strncasecmp -#define strlwr(STRARG) (STRARG) -#else -int my_vsnprintf_(char *to, size_t n, const char* value, ...); -#endif -#endif - -/****************************************************************************** - - macros - -******************************************************************************/ - -#define ARG_BUF 10 -#define TRY_MAX 5 - -#ifdef __WIN__ -#define PATH_MAX _MAX_PATH -#define NAME_MAX _MAX_FNAME -#define kill(A,B) TerminateProcess((HANDLE)A,0) -#define NOT_NEED_PID 0 -#define MASTER_PID 1 -#define SLAVE_PID 2 -#define mysqld_timeout 60000 - -int pid_mode; -bool run_server; -bool skip_first_param; - -#define snprintf _snprintf -#define vsnprintf _vsnprintf -#endif - - -/****************************************************************************** - - structures - -******************************************************************************/ - -typedef struct -{ - - int argc; - char **argv; - - size_t size; - -} arg_list_t; - -#ifdef __WIN__ -typedef int pid_t; -#endif -/****************************************************************************** - - global variables - -******************************************************************************/ - -/****************************************************************************** - - prototypes - -******************************************************************************/ - -void init_args(arg_list_t *); -void add_arg(arg_list_t *, const char *, ...); -void free_args(arg_list_t *); - -#ifndef __WIN__ -int sleep_until_file_exists(char *); -int sleep_until_file_deleted(char *); -#else -int sleep_until_file_exists(HANDLE); -int sleep_until_file_deleted(HANDLE); -#endif -int wait_for_server_start(char *, char *, char *, char *, int,char *); - -#ifndef __WIN__ -int spawn(char *, arg_list_t *, int, char *, char *, char *, char *); -#else -int spawn(char *, arg_list_t *, int , char *, char *, char *, HANDLE *); -#endif - -#ifndef __WIN__ -int stop_server(char *, char *, char *, char *, int, char *,char *); -pid_t get_server_pid(char *); -void kill_server(pid_t pid); -#else -int stop_server(char *, char *, char *, char *, int, HANDLE,char *); -#endif -void del_tree(char *); -int removef(const char *, ...); - -void get_basedir(char *, char *); -void remove_empty_file(const char *file_name); - -bool create_system_files(const char *mdata,const char *output_file, bool test); - -#endif /* _MY_MANAGE */ diff --git a/mysql-test/mysql_test_run_new.c b/mysql-test/mysql_test_run_new.c deleted file mode 100644 index f9c0045472d..00000000000 --- a/mysql-test/mysql_test_run_new.c +++ /dev/null @@ -1,1941 +0,0 @@ -/* - Copyright (c) 2002, 2003 Novell, Inc. All Rights Reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include -#include -#ifndef __WIN__ -#include -#endif -#include -#ifdef __NETWARE__ -#include -#include -#endif -#include -#include -#ifndef __WIN__ -#include -#endif -#include -#ifdef __NETWARE__ -#include -#endif -#ifdef __WIN__ -#include -#include -#include -#endif - -#include "my_manage.h" - -/****************************************************************************** - - macros - -******************************************************************************/ - -#define HEADER "TEST RESULT \n" -#define DASH "-------------------------------------------------------\n" - -#define NW_TEST_SUFFIX ".nw-test" -#define NW_RESULT_SUFFIX ".nw-result" -#define TEST_SUFFIX ".test" -#define RESULT_SUFFIX ".result" -#define REJECT_SUFFIX ".reject" -#define OUT_SUFFIX ".out" -#define ERR_SUFFIX ".err" - -const char *TEST_PASS= "[ pass ]"; -const char *TEST_SKIP= "[ skip ]"; -const char *TEST_FAIL= "[ fail ]"; -const char *TEST_BAD= "[ bad ]"; -const char *TEST_IGNORE= "[ignore]"; - -/****************************************************************************** - - global variables - -******************************************************************************/ - -#ifdef __NETWARE__ -static char base_dir[FN_REFLEN]= "sys:/mysql"; -#else -static char base_dir[FN_REFLEN]= ".."; -#endif -static char db[FN_LEN]= "test"; -static char user[FN_LEN]= "root"; -static char password[FN_LEN]= ""; - -int master_port= 9306; -int slave_port= 9307; - -#if !defined(__NETWARE__) && !defined(__WIN__) -static char master_socket[FN_REFLEN]= "./var/tmp/master.sock"; -static char slave_socket[FN_REFLEN]= "./var/tmp/slave.sock"; -#endif - -#define MAX_COUNT_TESTES 1024 - -#ifdef __WIN__ -# define sting_compare_func _stricmp -#else -# ifdef HAVE_STRCASECMP -# define sting_compare_func strcasecmp -# else -# define sting_compare_func strcmp -# endif -#endif - -/* comma delimited list of tests to skip or empty string */ -#ifndef __WIN__ -static char skip_test[FN_REFLEN]= " lowercase_table3 , system_mysql_db_fix "; -#else -/* - The most ignore testes contain the calls of system command - - lowercase_table3 is disabled by Gerg - system_mysql_db_fix is disabled by Gerg - sp contains a command system - rpl_EE_error contains a command system - rpl_loaddatalocal contains a command system - ndb_autodiscover contains a command system - rpl_rotate_logs contains a command system - repair contains a command system - rpl_trunc_binlog contains a command system - mysqldump contains a command system - rpl000001 makes non-exit loop...temporary skiped -*/ -static char skip_test[FN_REFLEN]= -" lowercase_table3 ," -" system_mysql_db_fix ," -" sp ," -" rpl_EE_error ," -" rpl_loaddatalocal ," -" ndb_autodiscover ," -" rpl_rotate_logs ," -" repair ," -" rpl_trunc_binlog ," -" mysqldump ," -" rpl000001 ," - -" derived ," -" group_by ," -" select ," -" rpl000015 ," -" subselect "; -#endif -static char ignore_test[FN_REFLEN]= ""; - -static char bin_dir[FN_REFLEN]; -static char mysql_test_dir[FN_REFLEN]; -static char test_dir[FN_REFLEN]; -static char mysql_tmp_dir[FN_REFLEN]; -static char result_dir[FN_REFLEN]; -static char master_dir[FN_REFLEN]; -static char slave_dir[FN_REFLEN]; -static char slave1_dir[FN_REFLEN]; -static char slave2_dir[FN_REFLEN]; -static char lang_dir[FN_REFLEN]; -static char char_dir[FN_REFLEN]; - -static char mysqladmin_file[FN_REFLEN]; -static char mysqld_file[FN_REFLEN]; -static char mysqltest_file[FN_REFLEN]; -#ifndef __WIN__ -static char master_pid[FN_REFLEN]; -static char slave_pid[FN_REFLEN]; -static char sh_file[FN_REFLEN]= "/bin/sh"; -#else -static HANDLE master_pid; -static HANDLE slave_pid; -#endif - -static char master_opt[FN_REFLEN]= ""; -static char slave_opt[FN_REFLEN]= ""; - -static char slave_master_info[FN_REFLEN]= ""; - -static char master_init_script[FN_REFLEN]= ""; -static char slave_init_script[FN_REFLEN]= ""; - -/* OpenSSL */ -static char ca_cert[FN_REFLEN]; -static char server_cert[FN_REFLEN]; -static char server_key[FN_REFLEN]; -static char client_cert[FN_REFLEN]; -static char client_key[FN_REFLEN]; - -int total_skip= 0; -int total_pass= 0; -int total_fail= 0; -int total_test= 0; - -int total_ignore= 0; - -int use_openssl= FALSE; -int master_running= FALSE; -int slave_running= FALSE; -int skip_slave= TRUE; -int single_test= TRUE; - -int restarts= 0; - -FILE *log_fd= NULL; - -static char argument[FN_REFLEN]; - -/****************************************************************************** - - functions - -******************************************************************************/ - -/****************************************************************************** - - prototypes - -******************************************************************************/ - -void report_stats(); -void install_db(char *); -void mysql_install_db(); -void start_master(); -void start_slave(); -void mysql_start(); -void stop_slave(); -void stop_master(); -void mysql_stop(); -void mysql_restart(); -int read_option(char *, char *); -void run_test(char *); -void setup(char *); -void vlog(const char *, va_list); -void mlog(const char *, ...); -void log_info(const char *, ...); -void log_error(const char *, ...); -void log_errno(const char *, ...); -void die(const char *); -char *str_tok(char* dest, char *string, const char *delim); -#ifndef __WIN__ -void run_init_script(const char *script_name); -#endif -/****************************************************************************** - - report_stats() - - Report the gathered statistics. - -******************************************************************************/ - -void report_stats() -{ - if (total_fail == 0) - { - mlog("\nAll %d test(s) were successful.\n", total_test); - } - else - { - double percent= ((double)total_pass / total_test) * 100; - - mlog("\nFailed %u/%u test(s), %.02f%% successful.\n", - total_fail, total_test, percent); - mlog("\nThe .out and .err files in %s may give you some\n", result_dir); - mlog("hint of what when wrong.\n"); - mlog("\nIf you want to report this error, please first read " - "the documentation\n"); - mlog("at: http://www.mysql.com/doc/M/y/MySQL_test_suite.html\n"); - } -} - -/****************************************************************************** - - install_db() - - Install the a database. - -******************************************************************************/ - -void install_db(char *datadir) -{ - arg_list_t al; - int err; - char input[FN_REFLEN]; - char output[FN_REFLEN]; - char error[FN_REFLEN]; - - /* input file */ -#ifdef __NETWARE__ - snprintf(input, FN_REFLEN, "%s/bin/init_db.sql", base_dir); -#else - snprintf(input, FN_REFLEN, "%s/mysql-test/init_db.sql", base_dir); -#endif - snprintf(output, FN_REFLEN, "%s/install.out", datadir); - snprintf(error, FN_REFLEN, "%s/install.err", datadir); - - if (create_system_files(datadir,input, TRUE)) - die("Unable to create init_db.sql."); - /* args */ - init_args(&al); - /* - XXX: If mysqld is compiled with DISABLE_GRANT_OPTIONS defined, it - will not recognize the --bootstrap, --init-file or --skip-grant- - tables options. If this is needed here, please check - MYSQLD_BOOTSTRAP in the environment, and use its value instead of - mysqld_file if it is set. See mysql-test-run.pl and - mysql_install_db. - */ - add_arg(&al, mysqld_file); - add_arg(&al, "--no-defaults"); - add_arg(&al, "--bootstrap"); - add_arg(&al, "--skip-grant-tables"); - add_arg(&al, "--basedir=%s", base_dir); - add_arg(&al, "--datadir=%s", datadir); - add_arg(&al, "--skip-innodb"); - add_arg(&al, "--skip-ndbcluster"); - add_arg(&al, "--skip-bdb"); -#ifndef __NETWARE__ - add_arg(&al, "--character-sets-dir=%s", char_dir); - add_arg(&al, "--language=%s", lang_dir); -#endif -// added - add_arg(&al, "--default-character-set=latin1"); - add_arg(&al, "--innodb_data_file_path=ibdata1:50M"); - - /* spawn */ - if ((err= spawn(mysqld_file, &al, TRUE, input, output, error, NULL)) != 0) - { - die("Unable to create database."); - } - - /* free args */ - free_args(&al); -} - -/****************************************************************************** - - mysql_install_db() - - Install the test databases. - -******************************************************************************/ - -void mysql_install_db() -{ - char temp[FN_REFLEN]; - - /* var directory */ - snprintf(temp, FN_REFLEN, "%s/var", mysql_test_dir); - - /* create var directory */ -#ifndef __WIN__ - mkdir(temp, S_IRWXU); - /* create subdirectories */ - mlog("Creating test-suite folders...\n"); - snprintf(temp, FN_REFLEN, "%s/var/run", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, FN_REFLEN, "%s/var/tmp", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, FN_REFLEN, "%s/var/master-data", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, FN_REFLEN, "%s/var/master-data/mysql", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, FN_REFLEN, "%s/var/master-data/test", mysql_test_dir); - mkdir(temp, S_IRWXU); - - snprintf(temp, FN_REFLEN, "%s/var/slave-data", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, FN_REFLEN, "%s/var/slave-data/mysql", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, FN_REFLEN, "%s/var/slave-data/test", mysql_test_dir); - mkdir(temp, S_IRWXU); - - snprintf(temp, FN_REFLEN, "%s/var/slave1-data", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, FN_REFLEN, "%s/var/slave1-data/mysql", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, FN_REFLEN, "%s/var/slave1-data/test", mysql_test_dir); - mkdir(temp, S_IRWXU); - - snprintf(temp, FN_REFLEN, "%s/var/slave2-data", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, FN_REFLEN, "%s/var/slave2-data/mysql", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, FN_REFLEN, "%s/var/slave2-data/test", mysql_test_dir); - mkdir(temp, S_IRWXU); -#else - mkdir(temp); - /* create subdirectories */ - mlog("Creating test-suite folders...\n"); - snprintf(temp, FN_REFLEN, "%s/var/run", mysql_test_dir); - mkdir(temp); - snprintf(temp, FN_REFLEN, "%s/var/tmp", mysql_test_dir); - mkdir(temp); - snprintf(temp, FN_REFLEN, "%s/var/master-data", mysql_test_dir); - mkdir(temp); - snprintf(temp, FN_REFLEN, "%s/var/master-data/mysql", mysql_test_dir); - mkdir(temp); - snprintf(temp, FN_REFLEN, "%s/var/master-data/test", mysql_test_dir); - mkdir(temp); - snprintf(temp, FN_REFLEN, "%s/var/slave-data", mysql_test_dir); - mkdir(temp); - snprintf(temp, FN_REFLEN, "%s/var/slave-data/mysql", mysql_test_dir); - mkdir(temp); - snprintf(temp, FN_REFLEN, "%s/var/slave-data/test", mysql_test_dir); - mkdir(temp); -#endif - - /* install databases */ - mlog("Creating test databases for master... \n"); - install_db(master_dir); - mlog("Creating test databases for slave... \n"); - install_db(slave_dir); - install_db(slave1_dir); - install_db(slave2_dir); -} - -/****************************************************************************** - - start_master() - - Start the master server. - -******************************************************************************/ - -void start_master() -{ - arg_list_t al; - int err; - char master_out[FN_REFLEN]; - char master_err[FN_REFLEN]; - char temp2[FN_REFLEN]; - - /* remove old berkeley db log files that can confuse the server */ - removef("%s/log.*", master_dir); - - /* remove stale binary logs */ - removef("%s/var/log/*-bin.*", mysql_test_dir); - - /* remove stale binary logs */ - removef("%s/var/log/*.index", mysql_test_dir); - - /* remove master.info file */ - removef("%s/master.info", master_dir); - - /* remove relay files */ - removef("%s/var/log/*relay*", mysql_test_dir); - - /* remove relay-log.info file */ - removef("%s/relay-log.info", master_dir); - - /* init script */ - if (master_init_script[0] != 0) - { -#ifdef __NETWARE__ - /* TODO: use the scripts */ - if (strinstr(master_init_script, "repair_part2-master.sh") != 0) - { - FILE *fp; - - /* create an empty index file */ - snprintf(temp, FN_REFLEN, "%s/test/t1.MYI", master_dir); - fp= fopen(temp, "wb+"); - - fputs("1", fp); - - fclose(fp); - } -#elif !defined(__WIN__) - run_init_script(master_init_script); -#endif - } - - /* redirection files */ - snprintf(master_out, FN_REFLEN, "%s/var/run/master%u.out", - mysql_test_dir, restarts); - snprintf(master_err, FN_REFLEN, "%s/var/run/master%u.err", - mysql_test_dir, restarts); -#ifndef __WIN__ - snprintf(temp2,FN_REFLEN,"%s/var",mysql_test_dir); - mkdir(temp2,S_IRWXU); - snprintf(temp2,FN_REFLEN,"%s/var/log",mysql_test_dir); - mkdir(temp2,S_IRWXU); -#else - snprintf(temp2,FN_REFLEN,"%s/var",mysql_test_dir); - mkdir(temp2); - snprintf(temp2,FN_REFLEN,"%s/var/log",mysql_test_dir); - mkdir(temp2); -#endif - /* args */ - init_args(&al); - add_arg(&al, "%s", mysqld_file); - add_arg(&al, "--no-defaults"); - add_arg(&al, "--log-bin=%s/var/log/master-bin",mysql_test_dir); - add_arg(&al, "--server-id=1"); - add_arg(&al, "--basedir=%s", base_dir); - add_arg(&al, "--port=%u", master_port); -#if !defined(__NETWARE__) && !defined(__WIN__) - add_arg(&al, "--socket=%s",master_socket); -#endif - add_arg(&al, "--local-infile"); - add_arg(&al, "--core"); - add_arg(&al, "--log-bin-trust-function-creators"); - add_arg(&al, "--datadir=%s", master_dir); -#ifndef __WIN__ - add_arg(&al, "--pid-file=%s", master_pid); -#endif - add_arg(&al, "--character-sets-dir=%s", char_dir); - add_arg(&al, "--tmpdir=%s", mysql_tmp_dir); - add_arg(&al, "--language=%s", lang_dir); - - add_arg(&al, "--rpl-recovery-rank=1"); - add_arg(&al, "--init-rpl-role=master"); - add_arg(&al, "--default-character-set=latin1"); -// add_arg(&al, "--innodb_data_file_path=ibdata1:50M"); -#ifdef DEBUG /* only for debug builds */ - add_arg(&al, "--debug"); -#endif - - if (use_openssl) - { - add_arg(&al, "--ssl-ca=%s", ca_cert); - add_arg(&al, "--ssl-cert=%s", server_cert); - add_arg(&al, "--ssl-key=%s", server_key); - } - - /* $MASTER_40_ARGS */ - add_arg(&al, "--rpl-recovery-rank=1"); - add_arg(&al, "--init-rpl-role=master"); - - /* $SMALL_SERVER */ - add_arg(&al, "-O"); - add_arg(&al, "key_buffer_size=1M"); - add_arg(&al, "-O"); - add_arg(&al, "sort_buffer=256K"); - add_arg(&al, "-O"); - add_arg(&al, "max_heap_table_size=1M"); - - /* $EXTRA_MASTER_OPT */ - if (master_opt[0] != 0) - { - char *p; - - p= (char *)str_tok(argument, master_opt, " \t"); - if (!strstr(master_opt, "timezone")) - { - while (p) - { - add_arg(&al, "%s", p); - p= (char *)str_tok(argument, NULL, " \t"); - } - } - } - - /* remove the pid file if it exists */ -#ifndef __WIN__ - remove(master_pid); -#endif - - /* spawn */ -#ifdef __WIN__ - if ((err= spawn(mysqld_file, &al, FALSE, NULL, - master_out, master_err, &master_pid)) == 0) -#else - if ((err= spawn(mysqld_file, &al, FALSE, NULL, - master_out, master_err, master_pid)) == 0) -#endif - { - sleep_until_file_exists(master_pid); - - if ((err= wait_for_server_start(bin_dir, mysqladmin_file, user, password, - master_port, mysql_tmp_dir)) == 0) - { - master_running= TRUE; - } - else - { - log_error("The master server went down early."); - } - } - else - { - log_error("Unable to start master server."); - } - - /* free_args */ - free_args(&al); -} - -/****************************************************************************** - - start_slave() - - Start the slave server. - -******************************************************************************/ - -void start_slave() -{ - arg_list_t al; - int err; - char slave_out[FN_REFLEN]; - char slave_err[FN_REFLEN]; - - /* skip? */ - if (skip_slave) return; - - /* remove stale binary logs */ - removef("%s/*-bin.*", slave_dir); - - /* remove stale binary logs */ - removef("%s/*.index", slave_dir); - - /* remove master.info file */ - removef("%s/master.info", slave_dir); - - /* remove relay files */ - removef("%s/var/log/*relay*", mysql_test_dir); - - /* remove relay-log.info file */ - removef("%s/relay-log.info", slave_dir); - - /* init script */ - if (slave_init_script[0] != 0) - { -#ifdef __NETWARE__ - /* TODO: use the scripts */ - if (strinstr(slave_init_script, "rpl000016-slave.sh") != 0) - { - /* create empty master.info file */ - snprintf(temp, FN_REFLEN, "%s/master.info", slave_dir); - close(open(temp, O_WRONLY | O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO)); - } - else if (strinstr(slave_init_script, "rpl000017-slave.sh") != 0) - { - FILE *fp; - - /* create a master.info file */ - snprintf(temp, FN_REFLEN, "%s/master.info", slave_dir); - fp= fopen(temp, "wb+"); - - fputs("master-bin.000001\n", fp); - fputs("4\n", fp); - fputs("127.0.0.1\n", fp); - fputs("replicate\n", fp); - fputs("aaaaaaaaaaaaaaab\n", fp); - fputs("9306\n", fp); - fputs("1\n", fp); - fputs("0\n", fp); - - fclose(fp); - } - else if (strinstr(slave_init_script, "rpl_rotate_logs-slave.sh") != 0) - { - /* create empty master.info file */ - snprintf(temp, FN_REFLEN, "%s/master.info", slave_dir); - close(open(temp, O_WRONLY | O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO)); - } -#elif !defined(__WIN__) - run_init_script(slave_init_script); -#endif - } - - /* redirection files */ - snprintf(slave_out, FN_REFLEN, "%s/var/run/slave%u.out", - mysql_test_dir, restarts); - snprintf(slave_err, FN_REFLEN, "%s/var/run/slave%u.err", - mysql_test_dir, restarts); - - /* args */ - init_args(&al); - add_arg(&al, "%s", mysqld_file); - add_arg(&al, "--no-defaults"); - add_arg(&al, "--log-bin=slave-bin"); - add_arg(&al, "--relay_log=slave-relay-bin"); - add_arg(&al, "--basedir=%s", base_dir); -#if !defined(__NETWARE__) && !defined(__WIN__) - add_arg(&al, "--socket=%s",slave_socket); -#endif - add_arg(&al, "--port=%u", slave_port); - add_arg(&al, "--datadir=%s", slave_dir); -#ifndef __WIN__ - add_arg(&al, "--pid-file=%s", slave_pid); -#endif - add_arg(&al, "--character-sets-dir=%s", char_dir); - add_arg(&al, "--core"); - add_arg(&al, "--tmpdir=%s", mysql_tmp_dir); - add_arg(&al, "--language=%s", lang_dir); - - add_arg(&al, "--exit-info=256"); - add_arg(&al, "--log-slave-updates"); - add_arg(&al, "--init-rpl-role=slave"); - add_arg(&al, "--skip-innodb"); - add_arg(&al, "--skip-slave-start"); - add_arg(&al, "--slave-load-tmpdir=../../var/tmp"); - - add_arg(&al, "--report-user=%s", user); - add_arg(&al, "--report-host=127.0.0.1"); - add_arg(&al, "--report-port=%u", slave_port); - - add_arg(&al, "--master-retry-count=10"); - add_arg(&al, "-O"); - add_arg(&al, "slave_net_timeout=10"); - add_arg(&al, "--log-slave-updates"); - add_arg(&al, "--log=%s/var/log/slave.log", mysql_test_dir); - add_arg(&al, "--default-character-set=latin1"); - add_arg(&al, "--skip-ndbcluster"); - -#ifdef DEBUG /* only for debug builds */ - add_arg(&al, "--debug"); -#endif - - if (use_openssl) - { - add_arg(&al, "--ssl-ca=%s", ca_cert); - add_arg(&al, "--ssl-cert=%s", server_cert); - add_arg(&al, "--ssl-key=%s", server_key); - } - - /* slave master info */ - if (slave_master_info[0] != 0) - { - char *p; - - p= (char *)str_tok(argument, slave_master_info, " \t"); - - while (p) - { - add_arg(&al, "%s", p); - p= (char *)str_tok(argument, NULL, " \t"); - } - } - else - { - add_arg(&al, "--master-user=%s", user); - add_arg(&al, "--master-password=%s", password); - add_arg(&al, "--master-host=127.0.0.1"); - add_arg(&al, "--master-port=%u", master_port); - add_arg(&al, "--master-connect-retry=1"); - add_arg(&al, "--server-id=2"); - add_arg(&al, "--rpl-recovery-rank=2"); - } - - /* small server */ - add_arg(&al, "-O"); - add_arg(&al, "key_buffer_size=1M"); - add_arg(&al, "-O"); - add_arg(&al, "sort_buffer=256K"); - add_arg(&al, "-O"); - add_arg(&al, "max_heap_table_size=1M"); - - - /* opt args */ - if (slave_opt[0] != 0) - { - char *p; - - p= (char *)str_tok(argument, slave_opt, " \t"); - - while (p) - { - add_arg(&al, "%s", p); - p= (char *)str_tok(argument, NULL, " \t"); - } - } - - /* remove the pid file if it exists */ -#ifndef __WIN__ - remove(slave_pid); -#endif - /* spawn */ -#ifdef __WIN__ - if ((err= spawn(mysqld_file, &al, FALSE, NULL, - slave_out, slave_err, &slave_pid)) == 0) -#else - if ((err= spawn(mysqld_file, &al, FALSE, NULL, - slave_out, slave_err, slave_pid)) == 0) -#endif - { - sleep_until_file_exists(slave_pid); - - if ((err= wait_for_server_start(bin_dir, mysqladmin_file, user, password, - slave_port, mysql_tmp_dir)) == 0) - { - slave_running= TRUE; - } - else - { - log_error("The slave server went down early."); - } - } - else - { - log_error("Unable to start slave server."); - } - - /* free args */ - free_args(&al); -} - -/****************************************************************************** - - mysql_start() - - Start the mysql servers. - -******************************************************************************/ - -void mysql_start() -{ - - - printf("loading master...\r"); - start_master(); - - printf("loading slave...\r"); - start_slave(); - - /* activate the test screen */ -#ifdef __NETWARE__ - ActivateScreen(getscreenhandle()); -#endif -} - -/****************************************************************************** - - stop_slave() - - Stop the slave server. - -******************************************************************************/ - -void stop_slave() -{ - int err; - - /* running? */ - if (!slave_running) return; - - /* stop */ - if ((err= stop_server(bin_dir, mysqladmin_file, user, password, - slave_port, slave_pid, mysql_tmp_dir)) == 0) - { - slave_running= FALSE; - } - else - { - log_error("Unable to stop slave server."); - } -} - -/****************************************************************************** - - stop_master() - - Stop the master server. - -******************************************************************************/ - -void stop_master() -{ - int err; - - /* running? */ - if (!master_running) return; - - if ((err= stop_server(bin_dir, mysqladmin_file, user, password, - master_port, master_pid, mysql_tmp_dir)) == 0) - { - master_running= FALSE; - } - else - { - log_error("Unable to stop master server."); - } -} - -/****************************************************************************** - - mysql_stop() - - Stop the mysql servers. - -******************************************************************************/ - -void mysql_stop() -{ - - stop_master(); - - stop_slave(); - - /* activate the test screen */ -#ifdef __NETWARE__ - ActivateScreen(getscreenhandle()); -#endif -} - -/****************************************************************************** - - mysql_restart() - - Restart the mysql servers. - -******************************************************************************/ - -void mysql_restart() -{ -/* log_info("Restarting the MySQL server(s): %u", ++restarts); */ - - mysql_stop(); - - mlog(DASH); - sleep(1); - - mysql_start(); -} - -/****************************************************************************** - - read_option() - - Read the option file. - -******************************************************************************/ - -int read_option(char *opt_file, char *opt) -{ - int fd, err; - char *p; - char buf[FN_REFLEN]; - - /* copy current option */ - strncpy(buf, opt, FN_REFLEN); - - /* open options file */ - fd= open(opt_file, O_RDONLY); - err= read(fd, opt, FN_REFLEN); - close(fd); - - if (err > 0) - { - /* terminate string */ - if ((p= strchr(opt, '\n')) != NULL) - { - *p= 0; - - /* check for a '\r' */ - if ((p= strchr(opt, '\r')) != NULL) - { - *p= 0; - } - } - else - { - opt[err]= 0; - } - - /* check for $MYSQL_TEST_DIR */ - if ((p= strstr(opt, "$MYSQL_TEST_DIR")) != NULL) - { - char temp[FN_REFLEN]; - - *p= 0; - - strcpy(temp, p + strlen("$MYSQL_TEST_DIR")); - strcat(opt, mysql_test_dir); - strcat(opt, temp); - } - /* Check for double backslash and replace it with single bakslash */ - if ((p= strstr(opt, "\\\\")) != NULL) - { - /* bmove is guranteed to work byte by byte */ - bmove(p, p+1, strlen(p)+1); - } - } - else - { - /* clear option */ - *opt= 0; - } - - /* compare current option with previous */ - return strcmp(opt, buf); -} - -/****************************************************************************** - - run_test() - - Run the given test case. - -******************************************************************************/ - -void run_test(char *test) -{ - char temp[FN_REFLEN]; - const char *rstr; - int skip= FALSE, ignore=FALSE; - int restart= FALSE; - int flag= FALSE; - struct stat info; - - /* skip tests in the skip list */ - snprintf(temp, FN_REFLEN, " %s ", test); - skip= (strinstr(skip_test, temp) != 0); - if (skip == FALSE) - ignore= (strinstr(ignore_test, temp) != 0); - - snprintf(master_init_script, FN_REFLEN, "%s/%s-master.sh", test_dir, test); - snprintf(slave_init_script, FN_REFLEN, "%s/%s-slave.sh", test_dir, test); -#ifdef __WIN__ - if (! stat(master_init_script, &info)) - skip= TRUE; - if (!stat(slave_init_script, &info)) - skip= TRUE; -#endif - if (ignore) - { - /* show test */ - mlog("%-46s ", test); - - /* ignore */ - rstr= TEST_IGNORE; - ++total_ignore; - } - else if (!skip) /* skip test? */ - { - char test_file[FN_REFLEN]; - char master_opt_file[FN_REFLEN]; - char slave_opt_file[FN_REFLEN]; - char slave_master_info_file[FN_REFLEN]; - char result_file[FN_REFLEN]; - char reject_file[FN_REFLEN]; - char out_file[FN_REFLEN]; - char err_file[FN_REFLEN]; - int err; - arg_list_t al; - /* skip slave? */ - flag= skip_slave; - skip_slave= (strncmp(test, "rpl", 3) != 0); - if (flag != skip_slave) restart= TRUE; - - /* create files */ - snprintf(master_opt_file, FN_REFLEN, "%s/%s-master.opt", test_dir, test); - snprintf(slave_opt_file, FN_REFLEN, "%s/%s-slave.opt", test_dir, test); - snprintf(slave_master_info_file, FN_REFLEN, "%s/%s.slave-mi", - test_dir, test); - snprintf(reject_file, FN_REFLEN, "%s/%s%s", - result_dir, test, REJECT_SUFFIX); - snprintf(out_file, FN_REFLEN, "%s/%s%s", result_dir, test, OUT_SUFFIX); - snprintf(err_file, FN_REFLEN, "%s/%s%s", result_dir, test, ERR_SUFFIX); - - /* netware specific files */ - snprintf(test_file, FN_REFLEN, "%s/%s%s", test_dir, test, NW_TEST_SUFFIX); - if (stat(test_file, &info)) - { - snprintf(test_file, FN_REFLEN, "%s/%s%s", test_dir, test, TEST_SUFFIX); - if (access(test_file,0)) - { - printf("Invalid test name %s, %s file not found\n",test,test_file); - return; - } - } - - snprintf(result_file, FN_REFLEN, "%s/%s%s", - result_dir, test, NW_RESULT_SUFFIX); - if (stat(result_file, &info)) - { - snprintf(result_file, FN_REFLEN, "%s/%s%s", - result_dir, test, RESULT_SUFFIX); - } - - /* init scripts */ - if (stat(master_init_script, &info)) - master_init_script[0]= 0; - else - restart= TRUE; - - if (stat(slave_init_script, &info)) - slave_init_script[0]= 0; - else - restart= TRUE; - - /* read options */ - if (read_option(master_opt_file, master_opt)) restart= TRUE; - if (read_option(slave_opt_file, slave_opt)) restart= TRUE; - if (read_option(slave_master_info_file, slave_master_info)) restart= TRUE; - - /* cleanup previous run */ - remove(reject_file); - remove(out_file); - remove(err_file); - - /* start or restart? */ - if (!master_running) mysql_start(); - else if (restart) mysql_restart(); - - /* show test */ - mlog("%-46s ", test); - - /* args */ - init_args(&al); - add_arg(&al, "%s", mysqltest_file); - add_arg(&al, "--no-defaults"); - add_arg(&al, "--port=%u", master_port); -#if !defined(__NETWARE__) && !defined(__WIN__) - add_arg(&al, "--socket=%s", master_socket); - add_arg(&al, "--tmpdir=%s", mysql_tmp_dir); -#endif - add_arg(&al, "--database=%s", db); - add_arg(&al, "--user=%s", user); - add_arg(&al, "--password=%s", password); - add_arg(&al, "--silent"); - add_arg(&al, "--basedir=%s/", mysql_test_dir); - add_arg(&al, "--host=127.0.0.1"); - add_arg(&al, "--skip-safemalloc"); - add_arg(&al, "-v"); - add_arg(&al, "-R"); - add_arg(&al, "%s", result_file); - - - if (use_openssl) - { - add_arg(&al, "--ssl-ca=%s", ca_cert); - add_arg(&al, "--ssl-cert=%s", client_cert); - add_arg(&al, "--ssl-key=%s", client_key); - } - - /* spawn */ - err= spawn(mysqltest_file, &al, TRUE, test_file, out_file, err_file, NULL); - /* free args */ - free_args(&al); - - remove_empty_file(out_file); - remove_empty_file(err_file); - - if (err == 0) - { - /* pass */ - rstr= TEST_PASS; - ++total_pass; - - /* increment total */ - ++total_test; - } - else if (err == 2) - { - /* skip */ - rstr= TEST_SKIP; - ++total_skip; - } - else if (err == 1) - { - /* fail */ - rstr= TEST_FAIL; - ++total_fail; - - /* increment total */ - ++total_test; - } - else - { - rstr= TEST_BAD; - } - } - else /* early skips */ - { - /* show test */ - mlog("%-46s ", test); - - /* skip */ - rstr= TEST_SKIP; - ++total_skip; - } - - /* result */ - mlog("%-14s\n", rstr); -} - -/****************************************************************************** - - vlog() - - Log the message. - -******************************************************************************/ - -void vlog(const char *format, va_list ap) -{ - vfprintf(stdout, format, ap); - fflush(stdout); - - if (log_fd) - { - vfprintf(log_fd, format, ap); - fflush(log_fd); - } -} - -/****************************************************************************** - - log() - - Log the message. - -******************************************************************************/ - -void mlog(const char *format, ...) -{ - va_list ap; - - va_start(ap, format); - - vlog(format, ap); - - va_end(ap); -} - -/****************************************************************************** - - log_info() - - Log the given information. - -******************************************************************************/ - -void log_info(const char *format, ...) -{ - va_list ap; - - va_start(ap, format); - - mlog("-- INFO : "); - vlog(format, ap); - mlog("\n"); - - va_end(ap); -} - -/****************************************************************************** - - log_error() - - Log the given error. - -******************************************************************************/ - -void log_error(const char *format, ...) -{ - va_list ap; - - va_start(ap, format); - - mlog("-- ERROR: "); - vlog(format, ap); - mlog("\n"); - - va_end(ap); -} - -/****************************************************************************** - - log_errno() - - Log the given error and errno. - -******************************************************************************/ - -void log_errno(const char *format, ...) -{ - va_list ap; - - va_start(ap, format); - - mlog("-- ERROR: (%003u) ", errno); - vlog(format, ap); - mlog("\n"); - - va_end(ap); -} - -/****************************************************************************** - - die() - - Exit the application. - -******************************************************************************/ - -void die(const char *msg) -{ - log_error(msg); -#ifdef __NETWARE__ - pressanykey(); -#endif - exit(-1); -} - -/****************************************************************************** - - setup() - - Setup the mysql test enviornment. - -******************************************************************************/ - -void setup(char *file __attribute__((unused))) -{ - char temp[FN_REFLEN]; -#if defined(__WIN__) || defined(__NETWARE__) - char file_path[FN_REFLEN*2]; -#endif - char *p; - int position; - - /* set the timezone for the timestamp test */ -#ifdef __WIN__ - _putenv( "TZ=GMT-3" ); -#else - putenv((char *)"TZ=GMT-3"); -#endif - /* find base dir */ -#ifdef __NETWARE__ - strcpy(temp, strlwr(file)); - while ((p= strchr(temp, '\\')) != NULL) *p= '/'; -#else - getcwd(temp, FN_REFLEN); - position= strlen(temp); - temp[position]= '/'; - temp[position+1]= 0; -#ifdef __WIN__ - while ((p= strchr(temp, '\\')) != NULL) *p= '/'; -#endif -#endif - - if ((position= strinstr(temp, "/mysql-test/")) != 0) - { - p= temp + position - 1; - *p= 0; - strcpy(base_dir, temp); - } - - log_info("Currect directory: %s",base_dir); - -#ifdef __NETWARE__ - /* setup paths */ - snprintf(bin_dir, FN_REFLEN, "%s/bin", base_dir); - snprintf(mysql_test_dir, FN_REFLEN, "%s/mysql-test", base_dir); - snprintf(test_dir, FN_REFLEN, "%s/t", mysql_test_dir); - snprintf(mysql_tmp_dir, FN_REFLEN, "%s/var/tmp", mysql_test_dir); - snprintf(result_dir, FN_REFLEN, "%s/r", mysql_test_dir); - snprintf(master_dir, FN_REFLEN, "%s/var/master-data", mysql_test_dir); - snprintf(slave_dir, FN_REFLEN, "%s/var/slave-data", mysql_test_dir); - snprintf(lang_dir, FN_REFLEN, "%s/share/english", base_dir); - snprintf(char_dir, FN_REFLEN, "%s/share/charsets", base_dir); - -#ifdef HAVE_OPENSSL - use_openssl= TRUE; -#endif /* HAVE_OPENSSL */ - - /* OpenSSL paths */ - snprintf(ca_cert, FN_REFLEN, "%s/std_data/cacert.pem", mysql_test_dir); - snprintf(server_cert, FN_REFLEN, "%s/std_data/server-cert.pem", mysql_test_dir); - snprintf(server_key, FN_REFLEN, "%s/std_data/server-key.pem", mysql_test_dir); - snprintf(client_cert, FN_REFLEN, "%s/std_data/client-cert.pem", mysql_test_dir); - snprintf(client_key, FN_REFLEN, "%s/std_data/client-key.pem", mysql_test_dir); - - /* setup files */ - snprintf(mysqld_file, FN_REFLEN, "%s/mysqld", bin_dir); - snprintf(mysqltest_file, FN_REFLEN, "%s/mysqltest", bin_dir); - snprintf(mysqladmin_file, FN_REFLEN, "%s/mysqladmin", bin_dir); - snprintf(master_pid, FN_REFLEN, "%s/var/run/master.pid", mysql_test_dir); - snprintf(slave_pid, FN_REFLEN, "%s/var/run/slave.pid", mysql_test_dir); -#elif __WIN__ - /* setup paths */ -#ifdef _DEBUG - snprintf(bin_dir, FN_REFLEN, "%s/client_debug", base_dir); -#else - snprintf(bin_dir, FN_REFLEN, "%s/client_release", base_dir); -#endif - snprintf(mysql_test_dir, FN_REFLEN, "%s/mysql-test", base_dir); - snprintf(test_dir, FN_REFLEN, "%s/t", mysql_test_dir); - snprintf(mysql_tmp_dir, FN_REFLEN, "%s/var/tmp", mysql_test_dir); - snprintf(result_dir, FN_REFLEN, "%s/r", mysql_test_dir); - snprintf(master_dir, FN_REFLEN, "%s/var/master-data", mysql_test_dir); - snprintf(slave_dir, FN_REFLEN, "%s/var/slave-data", mysql_test_dir); - snprintf(lang_dir, FN_REFLEN, "%s/share/english", base_dir); - snprintf(char_dir, FN_REFLEN, "%s/share/charsets", base_dir); - -#ifdef HAVE_OPENSSL - use_openssl= TRUE; -#endif /* HAVE_OPENSSL */ - - /* OpenSSL paths */ - snprintf(ca_cert, FN_REFLEN, "%s/std_data/cacert.pem", mysql_test_dir); - snprintf(server_cert, FN_REFLEN, "%s/std_data/server-cert.pem", mysql_test_dir); - snprintf(server_key, FN_REFLEN, "%s/std_data/server-key.pem", mysql_test_dir); - snprintf(client_cert, FN_REFLEN, "%s/std_data/client-cert.pem", mysql_test_dir); - snprintf(client_key, FN_REFLEN, "%s/std_data/client-key.pem", mysql_test_dir); - - /* setup files */ -#ifdef _DEBUG - snprintf(mysqld_file, FN_REFLEN, "%s/mysqld-debug.exe", bin_dir); -#else - snprintf(mysqld_file, FN_REFLEN, "%s/mysqld.exe", bin_dir); -#endif - snprintf(mysqltest_file, FN_REFLEN, "%s/mysqltest.exe", bin_dir); - snprintf(mysqladmin_file, FN_REFLEN, "%s/mysqladmin.exe", bin_dir); -#else - /* setup paths */ - snprintf(bin_dir, FN_REFLEN, "%s/client", base_dir); - snprintf(mysql_test_dir, FN_REFLEN, "%s/mysql-test", base_dir); - snprintf(test_dir, FN_REFLEN, "%s/t", mysql_test_dir); - snprintf(mysql_tmp_dir, FN_REFLEN, "%s/var/tmp", mysql_test_dir); - snprintf(result_dir, FN_REFLEN, "%s/r", mysql_test_dir); - snprintf(master_dir, FN_REFLEN, "%s/var/master-data", mysql_test_dir); - snprintf(slave_dir, FN_REFLEN, "%s/var/slave-data", mysql_test_dir); - snprintf(slave1_dir, FN_REFLEN, "%s/var/slave1-data", mysql_test_dir); - snprintf(slave2_dir, FN_REFLEN, "%s/var/slave2-data", mysql_test_dir); - snprintf(lang_dir, FN_REFLEN, "%s/sql/share/english", base_dir); - snprintf(char_dir, FN_REFLEN, "%s/sql/share/charsets", base_dir); - -#ifdef HAVE_OPENSSL - use_openssl= TRUE; -#endif /* HAVE_OPENSSL */ - - /* OpenSSL paths */ - snprintf(ca_cert, FN_REFLEN, "%s/std_data/cacert.pem", mysql_test_dir); - snprintf(server_cert, FN_REFLEN, "%s/std_data/server-cert.pem", mysql_test_dir); - snprintf(server_key, FN_REFLEN, "%s/std_data/server-key.pem", mysql_test_dir); - snprintf(client_cert, FN_REFLEN, "%s/std_data/client-cert.pem", mysql_test_dir); - snprintf(client_key, FN_REFLEN, "%s/std_data/client-key.pem", mysql_test_dir); - - /* setup files */ - snprintf(mysqld_file, FN_REFLEN, "%s/sql/mysqld", base_dir); - snprintf(mysqltest_file, FN_REFLEN, "%s/mysqltest", bin_dir); - snprintf(mysqladmin_file, FN_REFLEN, "%s/mysqladmin", bin_dir); - snprintf(master_pid, FN_REFLEN, "%s/var/run/master.pid", mysql_test_dir); - snprintf(slave_pid, FN_REFLEN, "%s/var/run/slave.pid", mysql_test_dir); - - snprintf(master_socket,FN_REFLEN, "%s/var/tmp/master.sock", mysql_test_dir); - snprintf(slave_socket,FN_REFLEN, "%s/var/tmp/slave.sock", mysql_test_dir); - -#endif - /* create log file */ - snprintf(temp, FN_REFLEN, "%s/mysql-test-run.log", mysql_test_dir); - if ((log_fd= fopen(temp, "w+")) == NULL) - { - log_errno("Unable to create log file."); - } - - /* prepare skip test list */ - while ((p= strchr(skip_test, ',')) != NULL) *p= ' '; - strcpy(temp, strlwr(skip_test)); - snprintf(skip_test, FN_REFLEN, " %s ", temp); - - /* environment */ -#ifdef __NETWARE__ - setenv("MYSQL_TEST_DIR", mysql_test_dir, 1); - snprintf(file_path, FN_REFLEN*2, - "%s/client/mysqldump --no-defaults -u root --port=%u", - bin_dir, master_port); - setenv("MYSQL_DUMP", file_path, 1); - snprintf(file_path, FN_REFLEN*2, - "%s/client/mysqlbinlog --no-defaults --local-load=%s", - bin_dir, mysql_tmp_dir); - setenv("MYSQL_BINLOG", file_path, 1); -#elif __WIN__ - snprintf(file_path,FN_REFLEN,"MYSQL_TEST_DIR=%s",mysql_test_dir); - _putenv(file_path); - snprintf(file_path, FN_REFLEN*2, - "MYSQL_DUMP=%s/mysqldump.exe --no-defaults -uroot --port=%u", - bin_dir, master_port); - _putenv(file_path); - snprintf(file_path, FN_REFLEN*2, - "MYSQL_BINLOG=%s/mysqlbinlog.exe --no-defaults --local-load=%s", - bin_dir, mysql_tmp_dir); - _putenv(file_path); - - snprintf(file_path, FN_REFLEN*2, - "TESTS_BINDIR=%s/tests", base_dir); - _putenv(file_path); - - snprintf(file_path, FN_REFLEN*2, - "CHARSETSDIR=%s/sql/share/charsets", base_dir); - _putenv(file_path); - - snprintf(file_path, FN_REFLEN*2, - "MYSQL=%s/mysql --port=%u ", - bin_dir, master_port); - _putenv(file_path); - - snprintf(file_path, FN_REFLEN*2, - "MYSQL_FIX_SYSTEM_TABLES=%s/scripts/mysql_fix_privilege_tables --no-defaults " - "--host=localhost --port=%u " - "--basedir=%s --bindir=%s --verbose", - base_dir,master_port, base_dir, bin_dir); - _putenv(file_path); - - snprintf(file_path, FN_REFLEN*2, - "NDB_TOOLS_DIR=%s/ndb/tools", base_dir); - _putenv(file_path); - - snprintf(file_path, FN_REFLEN*2, - "CLIENT_BINDIR=%s", bin_dir); - _putenv(file_path); - - snprintf(file_path, FN_REFLEN*2, - "MYSQL_CLIENT_TEST=%s/tests/mysql_client_test --no-defaults --testcase " - "--user=root --port=%u --silent", - base_dir, master_port); - _putenv(file_path); - -#else - { - static char env_MYSQL_TEST_DIR[FN_REFLEN*2]; - static char env_MYSQL_DUMP[FN_REFLEN*2]; - static char env_MYSQL_BINLOG[FN_REFLEN*2]; - static char env_MASTER_MYSOCK[FN_REFLEN*2]; - static char env_TESTS_BINDIR[FN_REFLEN*2]; - static char env_CHARSETSDIR[FN_REFLEN*2]; - static char env_MYSQL[FN_REFLEN*2]; - static char env_MYSQL_FIX_SYSTEM_TABLES[FN_REFLEN*2]; - static char env_CLIENT_BINDIR[FN_REFLEN*2]; - static char env_MYSQL_CLIENT_TEST[FN_REFLEN*2]; - static char env_NDB_TOOLS_DIR[FN_REFLEN*2]; - static char env_NDB_MGM[FN_REFLEN*2]; - static char env_NDB_BACKUP_DIR[FN_REFLEN*2]; - static char env_NDB_TOOLS_OUTPUT[FN_REFLEN*2]; - - snprintf(env_MYSQL_TEST_DIR,FN_REFLEN*2, - "MYSQL_TEST_DIR=%s",mysql_test_dir); - putenv(env_MYSQL_TEST_DIR); - - snprintf(env_MYSQL_DUMP, FN_REFLEN*2,"MYSQL_DUMP=%s/mysqldump --no-defaults " - "-uroot --port=%u --socket=%s ", - bin_dir, master_port, master_socket); - putenv(env_MYSQL_DUMP); - - snprintf(env_MYSQL_BINLOG, FN_REFLEN*2, - "MYSQL_BINLOG=%s/mysqlbinlog --no-defaults --local-load=%s -uroot ", - bin_dir, mysql_tmp_dir); - putenv(env_MYSQL_BINLOG); - - snprintf(env_MASTER_MYSOCK, FN_REFLEN*2, - "MASTER_MYSOCK=%s", master_socket); - putenv(env_MASTER_MYSOCK); - - snprintf(env_TESTS_BINDIR, FN_REFLEN*2, - "TESTS_BINDIR=%s/tests", base_dir); - putenv(env_TESTS_BINDIR); - - snprintf(env_CHARSETSDIR, FN_REFLEN*2, - "CHARSETSDIR=%s/sql/share/charsets", base_dir); - putenv(env_CHARSETSDIR); - - snprintf(env_MYSQL, FN_REFLEN*2, - "MYSQL=%s/mysql --port=%u --socket=%s -uroot ", - bin_dir, master_port, master_socket); - putenv(env_MYSQL); - - snprintf(env_MYSQL_FIX_SYSTEM_TABLES, FN_REFLEN*2, - "MYSQL_FIX_SYSTEM_TABLES=%s/scripts/mysql_fix_privilege_tables --no-defaults " - "--host=localhost --port=%u --socket=%s " - "--basedir=%s --bindir=%s --verbose -uroot ", - base_dir,master_port, master_socket, base_dir, bin_dir); - putenv(env_MYSQL_FIX_SYSTEM_TABLES); - - - snprintf(env_CLIENT_BINDIR, FN_REFLEN*2, - "CLIENT_BINDIR=%s", bin_dir); - putenv(env_CLIENT_BINDIR); - - snprintf(env_MYSQL_CLIENT_TEST, FN_REFLEN*2, - "MYSQL_CLIENT_TEST=%s/tests/mysql_client_test --no-defaults --testcase " - "--user=root --socket=%s --port=%u --silent", - base_dir, master_socket, master_port); - putenv(env_MYSQL_CLIENT_TEST); - - // NDB - - snprintf(env_NDB_TOOLS_DIR, FN_REFLEN*2, - "NDB_TOOLS_DIR=%s/ndb/tools", base_dir); - putenv(env_NDB_TOOLS_DIR); - - snprintf(env_NDB_MGM, FN_REFLEN*2, - "NDB_MGM=%s/ndb/src/mgmclient/ndb_mgm", base_dir); - putenv(env_NDB_MGM); - - //NDBCLUSTER_PORT=9350 - snprintf(env_NDB_BACKUP_DIR, FN_REFLEN*2, - "NDB_BACKUP_DIR=%s/var/ndbcluster-%i", mysql_test_dir, 9350); - putenv(env_NDB_BACKUP_DIR); - - snprintf(env_NDB_TOOLS_OUTPUT, FN_REFLEN*2, - "NDB_TOOLS_OUTPUT=%s/var/log/ndb_tools.log", mysql_test_dir); - putenv(env_NDB_TOOLS_OUTPUT); - - putenv((char *)"NDB_STATUS_OK=1"); - -// NDB_MGM="$BASEDIR/ndb/src/mgmclient/ndb_mgm" -// NDB_BACKUP_DIR=$MYSQL_TEST_DIR/var/ndbcluster-$NDBCLUSTER_PORT -// NDB_TOOLS_OUTPUT=$MYSQL_TEST_DIR/var/log/ndb_tools.log - } - -#endif - -#ifndef __WIN__ - putenv((char *)"MASTER_MYPORT=9306"); - putenv((char *)"SLAVE_MYPORT=9307"); - putenv((char *)"MYSQL_TCP_PORT=3306"); - -#else - _putenv("MASTER_MYPORT=9306"); - _putenv("SLAVE_MYPORT=9307"); - _putenv("MYSQL_TCP_PORT=3306"); -#endif - -} - -/* - Compare names of testes for right order -*/ -int compare( const void *arg1, const void *arg2 ) -{ - return sting_compare_func( * ( char** ) arg1, * ( char** ) arg2 ); -} - - - -/****************************************************************************** - - main() - -******************************************************************************/ - -int main(int argc, char **argv) -{ - int is_ignore_list= 0; - char **names= 0; - char **testes= 0; - int name_index; - int index; - char var_dir[FN_REFLEN]; - /* setup */ - setup(argv[0]); - - /* delete all file in var */ - snprintf(var_dir,FN_REFLEN,"%s/var",mysql_test_dir); - del_tree(var_dir); - - /* - The --ignore option is comma saperated list of test cases to skip and - should be very first command line option to the test suite. - - The usage is now: - mysql_test_run --ignore=test1,test2 test3 test4 - where test1 and test2 are test cases to ignore - and test3 and test4 are test cases to run. - */ - if (argc >= 2 && !strnicmp(argv[1], "--ignore=", sizeof("--ignore=")-1)) - { - char *temp, *token; - temp= strdup(strchr(argv[1],'=') + 1); - for (token=str_tok(argument, temp, ","); token != NULL; - token=str_tok(argument, NULL, ",")) - { - if (strlen(ignore_test) + strlen(token) + 2 <= FN_REFLEN-1) - sprintf(ignore_test+strlen(ignore_test), " %s ", token); - else - { - free(temp); - die("ignore list too long."); - } - } - free(temp); - is_ignore_list= 1; - } - /* header */ -#ifndef __WIN__ - mlog("MySQL Server %s, for %s (%s)\n\n", VERSION, SYSTEM_TYPE, MACHINE_TYPE); -#else - mlog("MySQL Server ---, for %s (%s)\n\n", SYSTEM_TYPE, MACHINE_TYPE); -#endif - - mlog("Initializing Tests...\n"); - - /* install test databases */ - mysql_install_db(); - - mlog("Starting Tests...\n"); - - mlog("\n"); - mlog(HEADER); - mlog(DASH); - - if ( argc > 1 + is_ignore_list ) - { - int i; - - /* single test */ - single_test= TRUE; - - for (i= 1 + is_ignore_list; i < argc; i++) - { - /* run given test */ - run_test(argv[i]); - } - } - else - { - /* run all tests */ - testes= malloc(MAX_COUNT_TESTES*sizeof(void*)); - if (!testes) - die("can not allcate memory for sorting"); - names= testes; - name_index= 0; -#ifndef __WIN__ - struct dirent *entry; - DIR *parent; - char test[FN_LEN]; - int position; - - /* FIXME are we sure the list is sorted if using readdir()? */ - if ((parent= opendir(test_dir)) == NULL) /* Not thread safe */ - die("Unable to open tests directory."); - else - { - while ((entry= readdir(parent)) != NULL) /* Not thread safe */ - { - strcpy(test, strlwr(entry->d_name)); - /* find the test suffix */ - if ((position= strinstr(test, TEST_SUFFIX)) != 0) - { - if (name_index < MAX_COUNT_TESTES) - { - /* null terminate at the suffix */ - *(test + position - 1)= '\0'; - /* insert test */ - *names= malloc(FN_REFLEN); - strcpy(*names,test); - names++; - name_index++; - } - else - die("can not sort files, array is overloaded"); - } - } - closedir(parent); - } -#else - { - struct _finddata_t dir; - int* handle; - char test[FN_LEN]; - char mask[FN_REFLEN]; - int position; - - /* single test */ - single_test= FALSE; - - snprintf(mask,FN_REFLEN,"%s/*.test",test_dir); - - if ((handle=_findfirst(mask,&dir)) == -1L) - { - die("Unable to open tests directory."); - } - - - do - { - if (!(dir.attrib & _A_SUBDIR)) - { - strcpy(test, strlwr(dir.name)); - - /* find the test suffix */ - if ((position= strinstr(test, TEST_SUFFIX)) != 0) - { - if (name_index < MAX_COUNT_TESTES) - { - /* null terminate at the suffix */ - *(test + position - 1)= '\0'; - /* insert test */ - *names= malloc(FN_REFLEN); - strcpy(*names,test); - names++; - name_index++; - } - else - die("can not sort files, array is overloaded"); - } - } - }while (_findnext(handle,&dir) == 0); - - _findclose(handle); - } -#endif - qsort( (void *)testes, name_index, sizeof( char * ), compare ); - - for (index= 0; index < name_index; index++) - { - run_test(testes[index]); - free(testes[index]); - } - - free(testes); - } - - /* stop server */ - mysql_stop(); - - mlog(DASH); - mlog("\n"); - - mlog("Ending Tests...\n"); - - /* report stats */ - report_stats(); - - /* close log */ - if (log_fd) fclose(log_fd); - - /* keep results up */ -#ifdef __NETWARE__ - pressanykey(); -#endif - return 0; -} - - -/* - Synopsis: - This function breaks the string into a sequence of tokens. The difference - between this function and strtok is that it respects the quoted string i.e. - it skips any delimiter character within the quoted part of the string. - It return tokens by eliminating quote character. It modifies the input string - passed. It will work with whitespace delimeter but may not work properly with - other delimeter. If the delimeter will contain any quote character, then - function will not tokenize and will return null string. - e.g. if input string is - --init-slave="set global max_connections=500" --skip-external-locking - then the output will two string i.e. - --init-slave=set global max_connections=500 - --skip-external-locking - -Arguments: - string: input string - delim: set of delimiter character -Output: - return the null terminated token of NULL. -*/ -char *str_tok(char* dest, char *string, const char *delim) -{ - char *token; - char *ptr_end_token= NULL; - char *ptr_quote= NULL; - char *ptr_token= NULL; - int count_quotes= 0; - - *dest = '\0'; - if (strchr(delim,'\'') || strchr(delim,'\"')) - return NULL; - - token= (char*)strtok(string, delim); - if (token) - { - /* double quote is found */ - if (strchr(token,'\"')) - { - do - { - if (count_quotes & 1) - { - if (*dest == '\0') - sprintf(dest,"%s", ptr_token); - else - sprintf(dest,"%s %s", dest, ptr_token); - ptr_token= (char*)strtok(NULL, delim); - if (!ptr_token) - break; - } - else - { - ptr_token= token; - } - if (ptr_quote = strchr(ptr_token,'\"')) - { - ptr_end_token= ptr_token + strlen(ptr_token); - do - { -#ifndef __WIN__ - bmove(ptr_quote, ptr_quote+1, ptr_end_token - ptr_quote); -#endif - count_quotes++; - } while (ptr_quote != NULL && (ptr_quote = strchr(ptr_quote+1,'\"'))); - } - /* there are unpair quotes we have to search next quote*/ - } while (count_quotes & 1); - if (ptr_token != NULL) - { - if (*dest == '\0') - sprintf(dest,"%s", ptr_token); - else - sprintf(dest,"%s %s",dest,ptr_token); - } - } - else - { - sprintf(dest,"%s",token); - } - } - return token ? dest : NULL; -} - -#ifndef __WIN__ -/* - Synopsis: - This function run scripts files on Linux and Netware - -Arguments: - script_name: name of script file - -Output: - nothing -*/ - -void run_init_script(const char *script_name) -{ - arg_list_t al; - int err; - - /* args */ - init_args(&al); - add_arg(&al, sh_file); - add_arg(&al, script_name); - - /* spawn */ - if ((err= spawn(sh_file, &al, TRUE, NULL, NULL, NULL, NULL)) != 0) - { - die("Unable to run script."); - } - - /* free args */ - free_args(&al); -} -#endif diff --git a/scripts/msql2mysql.sh b/scripts/msql2mysql.sh index 89a1fcea959..3c802d63705 100644 --- a/scripts/msql2mysql.sh +++ b/scripts/msql2mysql.sh @@ -1,16 +1,18 @@ #!/bin/sh -# Copyright (C) 1979-1996 TcX AB & Monty Program KB & Detron HB +# Copyright (C) 1979-2007 MySQL AB # -# This software is distributed with NO WARRANTY OF ANY KIND. No author or -# distributor accepts any responsibility for the consequences of using it, or -# for whether it serves any particular purpose or works at all, unless he or -# she says so in writing. Refer to the Free Public License (the "License") -# for full details. +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. # -# Every copy of this file must include a copy of the License, normally in a -# plain ASCII text file named PUBLIC. The License grants you the right to -# copy, modify and redistribute this file, but only under certain conditions -# described in the License. Among other things, the License requires that -# the copyright notice and this notice be preserved on all copies. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to the +# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston +# MA 02110-1301 USA. @bindir@/replace msqlConnect mysql_connect msqlListDBs mysql_list_dbs msqlNumRows mysql_num_rows msqlFetchRow mysql_fetch_row msqlFetchField mysql_fetch_field msqlFreeResult mysql_free_result msqlListFields mysql_list_fields msqlListTables mysql_list_tables msqlErrMsg 'mysql_error(mysql)' msqlStoreResult mysql_store_result msqlQuery mysql_query msqlField mysql_field msqlSelect mysql_select msqlSelectDB mysql_select_db msqlNumFields mysql_num_fields msqlClose mysql_close msqlDataSeek mysql_data_seek m_field MYSQL_FIELD m_result MYSQL_RES m_row MYSQL_ROW msql mysql mSQL mySQL MSQL MYSQL msqlCreateDB mysql_create_db msqlDropDB mysql_drop_db msqlFieldSeek mysql_field_seek -- $* diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc index 7abdb5f488c..2d78999017a 100644 --- a/sql/gen_lex_hash.cc +++ b/sql/gen_lex_hash.cc @@ -445,10 +445,24 @@ int main(int argc,char **argv) /* Broken up to indicate that it's not advice to you, gentle reader. */ printf("/*\n\n Do " "not " "edit " "this " "file " "directly!\n\n*/\n"); - printf("/* Copyright (C) 2001-2004 MySQL AB\n\ - This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\ - and you are welcome to modify and redistribute it under the GPL license\n\ - \n*/\n\n"); + printf("\ +/* Copyright (C) 2001-2004 MySQL AB\n\ +\n\ + This program is free software; you can redistribute it and/or modify\n\ + it under the terms of the GNU General Public License as published by\n\ + the Free Software Foundation; version 2 of the License.\n\ +\n\ + This program is distributed in the hope that it will be useful,\n\ + but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ + GNU General Public License for more details.\n\ +\n\ + You should have received a copy of the GNU General Public License\n\ + along with this program; see the file COPYING. If not, write to the\n\ + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston\n\ + MA 02110-1301 USA. */\n\ +\n\ +"); /* Broken up to indicate that it's not advice to you, gentle reader. */ printf("/* Do " "not " "edit " "this " "file! This is generated by " diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 528b1f2746b..cbd74cf557e 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -1,3 +1,19 @@ +# Copyright (C) 2000-2007 MySQL AB +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to the +# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston +# MA 02110-1301 USA. + %define mysql_version @VERSION@ # use "rpmbuild --with static" or "rpm --define '_with_static 1'" (for RPM 3.x) @@ -70,12 +86,9 @@ is intended for mission-critical, heavy-load production systems as well as for embedding into mass-deployed software. MySQL is a trademark of MySQL AB. -The MySQL software has Dual Licensing, which means you can use the MySQL -software free of charge under the GNU General Public License -(http://www.gnu.org/licenses/). You can also purchase commercial MySQL -licenses from MySQL AB if you do not wish to be bound by the terms of -the GPL. See the chapter "Licensing and Support" in the manual for -further info. +Copyright (C) 2000-2007 MySQL AB +This software comes with ABSOLUTELY NO WARRANTY. This is free software, +and you are welcome to modify and redistribute it under the GPL license. The MySQL web site (http://www.mysql.com/) provides the latest news and information about the MySQL software. Also please see the @@ -95,12 +108,9 @@ is intended for mission-critical, heavy-load production systems as well as for embedding into mass-deployed software. MySQL is a trademark of MySQL AB. -The MySQL software has Dual Licensing, which means you can use the MySQL -software free of charge under the GNU General Public License -(http://www.gnu.org/licenses/). You can also purchase commercial MySQL -licenses from MySQL AB if you do not wish to be bound by the terms of -the GPL. See the chapter "Licensing and Support" in the manual for -further info. +Copyright (C) 2000-2007 MySQL AB +This software comes with ABSOLUTELY NO WARRANTY. This is free software, +and you are welcome to modify and redistribute it under the GPL license. The MySQL web site (http://www.mysql.com/) provides the latest news and information about the MySQL software. Also please see the From e56eb2288cc31a8a0d0cbf478aeb99f62be95ec3 Mon Sep 17 00:00:00 2001 From: "joerg@trift2." <> Date: Wed, 31 Jan 2007 15:25:56 +0100 Subject: [PATCH 08/11] Fix bug#23293 "readline detection broken on NetBSD": Its root cause is a difference between the "readline" and "libedit" (header files) definitions of "rl_completion_entry_function", where the "libedit" one is wrong anyway: This variable is used as a pointer to a function returning "char *", but "libedit" declares it as returning "int" and then adds casts on usage. Change it to "CPFunction *" and get rid of the casts. --- client/mysql.cc | 6 +++--- cmd-line-utils/libedit/readline.c | 11 +++++------ cmd-line-utils/libedit/readline/readline.h | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/client/mysql.cc b/client/mysql.cc index 4e479f3ff70..75dae284b61 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1420,7 +1420,7 @@ static char **new_mysql_completion (const char *text, int start, int end); #if defined(USE_NEW_READLINE_INTERFACE) || defined(USE_LIBEDIT_INTERFACE) char *no_completion(const char*,int) #else -int no_completion() +char *no_completion() #endif { return 0; /* No filename completion */ @@ -1508,10 +1508,10 @@ static void initialize_readline (char *name) setlocale(LC_ALL,""); /* so as libedit use isprint */ #endif rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion; - rl_completion_entry_function= (Function*)&no_completion; + rl_completion_entry_function= &no_completion; #else rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion; - rl_completion_entry_function= (Function*)&no_completion; + rl_completion_entry_function= &no_completion; #endif } diff --git a/cmd-line-utils/libedit/readline.c b/cmd-line-utils/libedit/readline.c index 8c09a6f39d5..004fcf7d183 100644 --- a/cmd-line-utils/libedit/readline.c +++ b/cmd-line-utils/libedit/readline.c @@ -112,7 +112,7 @@ int rl_attempted_completion_over = 0; char *rl_basic_word_break_characters = break_chars; char *rl_completer_word_break_characters = NULL; char *rl_completer_quote_characters = NULL; -Function *rl_completion_entry_function = NULL; +CPFunction *rl_completion_entry_function = NULL; CPPFunction *rl_attempted_completion_function = NULL; Function *rl_pre_input_hook = NULL; Function *rl_startup1_hook = NULL; @@ -1724,7 +1724,7 @@ rl_display_match_list (matches, len, max) static int _rl_complete_internal(int what_to_do) { - Function *complet_func; + CPFunction *complet_func; const LineInfo *li; char *temp, **matches; const char *ctemp; @@ -1737,7 +1737,7 @@ _rl_complete_internal(int what_to_do) complet_func = rl_completion_entry_function; if (!complet_func) - complet_func = (Function *)(void *)filename_completion_function; + complet_func = filename_completion_function; /* We now look backwards for the start of a filename/variable word */ li = el_line(e); @@ -1764,7 +1764,7 @@ _rl_complete_internal(int what_to_do) } else matches = 0; if (!rl_attempted_completion_function || !matches) - matches = completion_matches(temp, (CPFunction *)complet_func); + matches = completion_matches(temp, complet_func); if (matches) { int i, retval = CC_REFRESH; @@ -1789,8 +1789,7 @@ _rl_complete_internal(int what_to_do) * object is a directory. */ size_t alen = strlen(matches[0]); - if ((complet_func != - (Function *)filename_completion_function + if ((complet_func != filename_completion_function || (alen > 0 && (matches[0])[alen - 1] != '/')) && rl_completion_append_character) { char buf[2]; diff --git a/cmd-line-utils/libedit/readline/readline.h b/cmd-line-utils/libedit/readline/readline.h index c43f71fb51d..6b1fa186512 100644 --- a/cmd-line-utils/libedit/readline/readline.h +++ b/cmd-line-utils/libedit/readline/readline.h @@ -102,7 +102,7 @@ extern int max_input_history; extern char *rl_basic_word_break_characters; extern char *rl_completer_word_break_characters; extern char *rl_completer_quote_characters; -extern Function *rl_completion_entry_function; +extern CPFunction *rl_completion_entry_function; extern CPPFunction *rl_attempted_completion_function; extern int rl_completion_type; extern int rl_completion_query_items; From beb265b2fe82857a43d34ef4d67faf7822e14313 Mon Sep 17 00:00:00 2001 From: "df@kahlann.erinye.com" <> Date: Wed, 31 Jan 2007 18:18:44 +0100 Subject: [PATCH 09/11] MTR_BUILD_THREAD=auto for test runs during RPM build --- support-files/mysql.spec.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 528b1f2746b..0dbe59a8831 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -345,6 +345,8 @@ then fi ( cd mysql-test + MTR_BUILD_THREAD=auto + export MTR_BUILD_THREAD perl ./mysql-test-run.pl --force --report-features perl ./mysql-test-run.pl --force --ps-protocol true ) @@ -407,6 +409,8 @@ then fi ( cd mysql-test + MTR_BUILD_THREAD=auto + export MTR_BUILD_THREAD perl ./mysql-test-run.pl --force --report-features perl ./mysql-test-run.pl --force --ps-protocol true ) @@ -755,6 +759,10 @@ fi # itself - note that they must be ordered by date (important when # merging BK trees) %changelog +* Wed Jan 31 2007 Daniel Fischer + +- add MTR_BUILD_THREAD=auto to test runs. + * Fri Jan 05 2007 Kent Boortz - Add CFLAGS to gcc call with --print-libgcc-file, to make sure the From 010dc0b55c1255b75ca6ddd1bd058c157624b9df Mon Sep 17 00:00:00 2001 From: "gluh@mysql.com/eagle.(none)" <> Date: Thu, 1 Feb 2007 18:00:24 +0400 Subject: [PATCH 10/11] Valgrind error fixes Notes: This patch doesn't fix all issues in the tree and we need jani's fix for that This patch shoud not be merged into 5.0 --- mysql-test/r/ps.result | 15 -- mysql-test/r/symlink.result | 15 ++ mysql-test/t/ps.test | 18 -- mysql-test/t/symlink.test | 19 ++ mysql-test/valgrind.supp | 437 ++++++++++++++++++++++++++++++++++++ sql/field_conv.cc | 4 + sql/mysqld.cc | 3 + vio/viosslfactories.c | 4 + 8 files changed, 482 insertions(+), 33 deletions(-) create mode 100644 mysql-test/valgrind.supp diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 0d6b01f3481..d8a75737efc 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -1087,19 +1087,4 @@ t2 CREATE TABLE `t2` ( drop database mysqltest; deallocate prepare stmt1; deallocate prepare stmt2; -execute stmt; -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` char(10) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' -drop table t1; -execute stmt; -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` char(10) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' -drop table t1; -deallocate prepare stmt; End of 4.1 tests. diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result index bc7d3275754..9b21dc7e952 100644 --- a/mysql-test/r/symlink.result +++ b/mysql-test/r/symlink.result @@ -123,4 +123,19 @@ select * from t1; a 42 drop table t1; +execute stmt; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` char(10) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' +drop table t1; +execute stmt; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` char(10) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' +drop table t1; +deallocate prepare stmt; End of 4.1 tests diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index c963e59110f..a0133897f50 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -1128,22 +1128,4 @@ drop database mysqltest; deallocate prepare stmt1; deallocate prepare stmt2; # -# CREATE TABLE with DATA DIRECTORY option -# -# Protect ourselves from data left in tmp/ by a previos possibly failed -# test ---system rm -f $MYSQLTEST_VARDIR/tmp/t1.* ---disable_query_log -eval prepare stmt from "create table t1 (c char(10)) data directory='$MYSQLTEST_VARDIR/tmp'"; ---enable_query_log -execute stmt; ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -show create table t1; -drop table t1; -execute stmt; ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -show create table t1; -drop table t1; -deallocate prepare stmt; -# --echo End of 4.1 tests. diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test index 23fd779ee13..010ef496399 100644 --- a/mysql-test/t/symlink.test +++ b/mysql-test/t/symlink.test @@ -170,4 +170,23 @@ connection default; select * from t1; drop table t1; +# +# CREATE TABLE with DATA DIRECTORY option +# +# Protect ourselves from data left in tmp/ by a previos possibly failed +# test +--system rm -f $MYSQLTEST_VARDIR/tmp/t1.* +--disable_query_log +eval prepare stmt from "create table t1 (c char(10)) data directory='$MYSQLTEST_VARDIR/tmp'"; +--enable_query_log +execute stmt; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +show create table t1; +drop table t1; +execute stmt; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +show create table t1; +drop table t1; +deallocate prepare stmt; + --echo End of 4.1 tests diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp new file mode 100644 index 00000000000..716dca491ce --- /dev/null +++ b/mysql-test/valgrind.supp @@ -0,0 +1,437 @@ +# +# Suppress some common (not fatal) errors in system libraries found by valgrind +# + +# +# Pthread doesn't free all thread specific memory before program exists +# +{ + pthread allocate_tls memory loss + Memcheck:Leak + fun:calloc + fun:_dl_allocate_tls + fun:allocate_stack + fun:pthread_create* +} + +{ + pthread allocate_tls memory loss + Memcheck:Leak + fun:calloc + fun:_dl_allocate_tls + fun:pthread_create* +} + +{ + pthread allocate_dtv memory loss + Memcheck:Leak + fun:calloc + fun:allocate_dtv + fun:_dl_allocate_tls_storage + fun:__GI__dl_allocate_tls + fun:pthread_create +} + +{ + pthread allocate_dtv memory loss second + Memcheck:Leak + fun:calloc + fun:allocate_dtv + fun:_dl_allocate_tls + fun:pthread_create* +} + +{ + pthread memalign memory loss + Memcheck:Leak + fun:memalign + fun:_dl_allocate_tls_storage + fun:__GI__dl_allocate_tls + fun:pthread_create +} + +{ + pthread pthread_key_create + Memcheck:Leak + fun:malloc + fun:* + fun:* + fun:pthread_key_create + fun:my_thread_global_init +} + +{ + pthread strstr uninit + Memcheck:Cond + fun:strstr + obj:/lib/tls/libpthread.so.* + obj:/lib/tls/libpthread.so.* + fun:call_init + fun:_dl_init + obj:/lib/ld-*.so +} + +{ + pthread errno + Memcheck:Leak + fun:calloc + fun:_dlerror_run + fun:dlsym + fun:__errno_location +} + + +# +# Warnings in libz becasue it works with aligned memory(?) +# + +{ + libz tr_flush_block + Memcheck:Cond + fun:_tr_flush_block + fun:deflate_slow + fun:deflate + fun:do_flush + fun:gzclose +} + +{ + libz tr_flush_block2 + Memcheck:Cond + fun:_tr_flush_block + fun:deflate_slow + fun:deflate + fun:compress2 +} + +{ + libz longest_match + Memcheck:Cond + fun:longest_match + fun:deflate_slow + fun:deflate + fun:do_flush +} + +{ + libz longest_match2 + Memcheck:Cond + fun:longest_match + fun:deflate_slow + fun:deflate + fun:compress2 +} + +{ + libz longest_match 3 + Memcheck:Cond + fun:longest_match + fun:deflate_slow + fun:deflate + fun:gzclose +} + +{ + libz longest_match 4 + Memcheck:Cond + fun:longest_match + fun:deflate_slow + fun:deflate + fun:gzflush +} + +{ + libz deflate + Memcheck:Cond + obj:*/libz.so.* + obj:*/libz.so.* + fun:deflate + fun:compress2 +} + +{ + libz deflate2 + Memcheck:Cond + obj:*/libz.so.* + obj:*/libz.so.* + fun:deflate + obj:*/libz.so.* + fun:gzflush +} + + +# +# Warning from my_thread_init becasue mysqld dies before kill thread exists +# + +{ + my_thread_init kill thread memory loss second + Memcheck:Leak + fun:calloc + fun:my_thread_init + fun:kill_server_thread +} + +# +# Leaks reported in _dl_* internal functions on Linux amd64 / glibc2.3.2. +# + +{ + _dl_start invalid write8 + Memcheck:Addr8 + fun:_dl_start +} + +{ + _dl_start invalid write4 + Memcheck:Addr4 + fun:_dl_start +} + +{ + _dl_start/_dl_setup_hash invalid read8 + Memcheck:Addr8 + fun:_dl_setup_hash + fun:_dl_start +} + +{ + _dl_sysdep_start invalid write8 + Memcheck:Addr8 + fun:_dl_sysdep_start +} + +{ + _dl_init invalid write8 + Memcheck:Addr8 + fun:_dl_init +} + +{ + _dl_init invalid write4 + Memcheck:Addr4 + fun:_dl_init +} + +{ + _dl_init/_dl_init invalid read8 + Memcheck:Addr8 + fun:_dl_debug_initialize + fun:_dl_init +} + +{ + _dl_init/_dl_debug_state invalid read8 + Memcheck:Addr8 + fun:_dl_debug_state + fun:_dl_init +} + +{ + init invalid write8 + Memcheck:Addr8 + fun:init +} + +{ + fixup invalid write8 + Memcheck:Addr8 + fun:fixup +} + +{ + fixup/_dl_lookup_versioned_symbol invalid read8 + Memcheck:Addr8 + fun:_dl_lookup_versioned_symbol + fun:fixup +} + +{ + _dl_runtime_resolve invalid read8 + Memcheck:Addr8 + fun:_dl_runtime_resolve +} + +{ + __libc_start_main invalid write8 + Memcheck:Addr8 + fun:__libc_start_main +} + +{ + __libc_start_main/__sigjmp_save invalid write4 + Memcheck:Addr4 + fun:__sigjmp_save + fun:__libc_start_main +} + +# +# These seem to be libc threading stuff, not related to MySQL code (allocations +# during pthread_exit()). Googling shows other projects also using these +# suppressions. +# +# Note that these all stem from pthread_exit() deeper in the call stack, but +# Valgrind only allows the top four calls in the suppressions. +# + +{ + libc pthread_exit 1 + Memcheck:Leak + fun:malloc + fun:_dl_new_object + fun:_dl_map_object_from_fd + fun:_dl_map_object +} + +{ + libc pthread_exit 2 + Memcheck:Leak + fun:malloc + fun:_dl_map_object + fun:dl_open_worker + fun:_dl_catch_error +} + +{ + libc pthread_exit 3 + Memcheck:Leak + fun:malloc + fun:_dl_map_object_deps + fun:dl_open_worker + fun:_dl_catch_error +} + +{ + libc pthread_exit 4 + Memcheck:Leak + fun:calloc + fun:_dl_check_map_versions + fun:dl_open_worker + fun:_dl_catch_error +} + +{ + libc pthread_exit 5 + Memcheck:Leak + fun:calloc + fun:_dl_new_object + fun:_dl_map_object_from_fd + fun:_dl_map_object +} + + + +# +# This is seen internally in the system libraries on 64-bit RHAS3. +# + +{ + __lll_mutex_unlock_wake uninitialized + Memcheck:Param + futex(utime) + fun:__lll_mutex_unlock_wake +} + +# +# BUG#19940: NDB sends uninitialized parts of field buffers across the wire. +# This is "works as designed"; the uninitialized part is not used at the +# other end (but Valgrind cannot see this). +# +{ + bug19940 + Memcheck:Param + socketcall.sendto(msg) + fun:send + fun:_ZN15TCP_Transporter6doSendEv + fun:_ZN19TransporterRegistry11performSendEv + fun:_ZN19TransporterRegistry14forceSendCheckEi +} + +{ + OpenSSL_1 + Memcheck:Cond + fun:BN_num_bits_word + fun:BN_num_bits + fun:BN_mod_exp_mont_consttime + fun:BN_mod_exp_mont + obj:*libcrypto.so.* + obj:*libcrypto.so.* + fun:DH_generate_key + fun:ssl3_ctx_ctrl + fun:SSL_CTX_ctrl + fun:new_VioSSLAcceptorFd + fun:main +} + +{ + OpenSSL_2 + Memcheck:Value4 + fun:BN_num_bits_word + fun:BN_num_bits + fun:BN_mod_exp_mont_consttime + fun:BN_mod_exp_mont + obj:*libcrypto.so.* + obj:*libcrypto.so.* + fun:DH_generate_key + fun:ssl3_ctx_ctrl + fun:SSL_CTX_ctrl + fun:new_VioSSLAcceptorFd + fun:main +} + +{ + OpenSSL_3 + Memcheck:Value4 + fun:BN_mod_exp_mont_consttime + fun:BN_mod_exp_mont + obj:*libcrypto.so.* + obj:*libcrypto.so.* + fun:DH_generate_key + fun:ssl3_ctx_ctrl + fun:SSL_CTX_ctrl + fun:new_VioSSLAcceptorFd + fun:main +} + +{ + OpenSSL_4 + Memcheck:Cond + fun:BN_bin2bn + obj:*libcrypto.so.* + obj:*libcrypto.so.* + fun:DH_generate_key + fun:ssl3_ctx_ctrl + fun:SSL_CTX_ctrl + fun:new_VioSSLAcceptorFd + fun:main +} + +{ + OpenSSL_5 + Memcheck:Leak + fun:realloc + obj:*libcrypto.so.* + fun:CRYPTO_realloc + fun:lh_insert + fun:OBJ_NAME_add + fun:EVP_add_cipher + fun:OpenSSL_add_all_ciphers + fun:OPENSSL_add_all_algorithms_noconf + fun:new_VioSSLAcceptorFd + fun:main +} + +{ + OpenSSL_6 + Memcheck:Leak + fun:malloc + obj:*libcrypto.so.* + fun:CRYPTO_malloc + fun:lh_new + fun:OBJ_NAME_init + fun:OBJ_NAME_add + fun:EVP_add_cipher + fun:SSL_library_init + fun:new_VioSSLAcceptorFd + fun:main +} diff --git a/sql/field_conv.cc b/sql/field_conv.cc index d61b3735c91..59b550572c3 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -605,6 +605,10 @@ void field_conv(Field *to,Field *from) from->charset() == to->charset() && to->table->db_low_byte_first == from->table->db_low_byte_first) { // Identical fields +#ifdef HAVE_purify + /* This may happen if one does 'UPDATE ... SET x=x' */ + if (to->ptr != from->ptr) +#endif memcpy(to->ptr,from->ptr,to->pack_length()); return; } diff --git a/sql/mysqld.cc b/sql/mysqld.cc index d9962eec4c1..0cccf097132 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1070,7 +1070,10 @@ void clean_up(bool print_message) #endif #ifdef HAVE_OPENSSL if (ssl_acceptor_fd) + { + SSL_CTX_free(ssl_acceptor_fd->ssl_context); my_free((gptr) ssl_acceptor_fd, MYF(MY_ALLOW_ZERO_PTR)); + } #endif /* HAVE_OPENSSL */ #ifdef USE_REGEX my_regex_end(); diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c index 46306cf48bb..1ac5d96d158 100644 --- a/vio/viosslfactories.c +++ b/vio/viosslfactories.c @@ -289,6 +289,8 @@ new_VioSSLConnectorFd(const char* key_file, DBUG_RETURN(ptr); ctor_failure: DBUG_PRINT("exit", ("there was an error")); + if (ptr->ssl_context) + SSL_CTX_free(ptr->ssl_context); my_free((gptr)ptr,MYF(0)); DBUG_RETURN(0); } @@ -390,6 +392,8 @@ new_VioSSLAcceptorFd(const char *key_file, ctor_failure: DBUG_PRINT("exit", ("there was an error")); + if (ptr->ssl_context) + SSL_CTX_free(ptr->ssl_context); my_free((gptr) ptr,MYF(0)); DBUG_RETURN(0); } From b0e8f2b534d0314e41fa3005a584b6d3574216cc Mon Sep 17 00:00:00 2001 From: "istruewing@chilla.local" <> Date: Thu, 1 Feb 2007 15:59:51 +0100 Subject: [PATCH 11/11] Bug#25844: "make test" does not find mysql-test-run.pl Need to change directory before calling mysql-test-run.pl --- Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.am b/Makefile.am index 798d1944fd0..04d50ccfbaf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -123,6 +123,7 @@ tags: # making sure each user use different ports. test-ps: + cd mysql-test ; \ @PERL@ ./mysql-test-run.pl $(force) --ps-protocol test-ns: