From 375f08c30bd091723e11ba452f11120d8826dd60 Mon Sep 17 00:00:00 2001 From: "Sinisa@sinisa.nasamreza.org" <> Date: Sat, 2 Nov 2002 16:10:53 +0200 Subject: [PATCH 1/9] Added test case for the last fix --- mysql-test/r/func_test.result | 4 ++++ mysql-test/t/func_test.test | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/mysql-test/r/func_test.result b/mysql-test/r/func_test.result index 586e345ea10..da82567db4d 100644 --- a/mysql-test/r/func_test.result +++ b/mysql-test/r/func_test.result @@ -26,6 +26,10 @@ 1 1 1 -1.49 or -1.49 0.6 or 0.6 1 1 +start ctime1 ctime2 +2002-11-04 00:00:00 20021029165106 20021105164731 +start ctime1 ctime2 +2002-11-04 00:00:00 20021029165106 20021105164731 5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1 0 1 1 and 2 between 2 and 10 2 between 2 and 10 and 1 diff --git a/mysql-test/t/func_test.test b/mysql-test/t/func_test.test index ec44009b1a6..ccbb531e2e6 100644 --- a/mysql-test/t/func_test.test +++ b/mysql-test/t/func_test.test @@ -15,6 +15,16 @@ select 2 between 1 and 3, "monty" between "max" and "my",2=2 and "monty" between select 'b' between 'a' and 'c', 'B' between 'a' and 'c'; select 2 in (3,2,5,9,5,1),"monty" in ("david","monty","allan"), 1.2 in (1.4,1.2,1.0); select -1.49 or -1.49,0.6 or 0.6; +drop table if exists t1,t2; +CREATE TABLE t1 ( start datetime default NULL) TYPE=MyISAM; +INSERT INTO t1 VALUES ('2002-10-21 00:00:00'); +INSERT INTO t1 VALUES ('2002-10-28 00:00:00'); +INSERT INTO t1 VALUES ('2002-11-04 00:00:00'); +CREATE TABLE t2 ( ctime1 timestamp(14) NOT NULL, ctime2 timestamp(14) NOT NULL) TYPE=MyISAM; +INSERT INTO t2 VALUES (20021029165106,20021105164731); +select * from t1, t2 where t1.start between t2.ctime1 and t2.ctime2; +select * from t1, t2 where t1.start >= t2.ctime1 and t1.start <= t2.ctime2; +drop table if exists t1,t2; # # Wrong usage of functions From b507a8511711af1fa5b35c3f73be9f6227b4a0aa Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Tue, 19 Nov 2002 13:45:51 +0100 Subject: [PATCH 2/9] - applied patch for AMD x86-64 (thanks to Gwenole Beauchesne --- bdb/dist/aclocal/mutex.m4 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bdb/dist/aclocal/mutex.m4 b/bdb/dist/aclocal/mutex.m4 index a6b1fa1a053..5c9218da163 100644 --- a/bdb/dist/aclocal/mutex.m4 +++ b/bdb/dist/aclocal/mutex.m4 @@ -403,5 +403,7 @@ UTS/cc-assembly) ADDITIONAL_OBJS="$ADDITIONAL_OBJS uts4.cc${o}" AC_DEFINE(HAVE_MUTEX_UTS_CC_ASSEMBLY);; x86/gcc-assembly) ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS" AC_DEFINE(HAVE_MUTEX_X86_GCC_ASSEMBLY);; +x86_64/gcc-assembly) ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS" + AC_DEFINE(HAVE_MUTEX_X86_64_GCC_ASSEMBLY);; esac ])dnl From e8eba53453db11d663bb35a874699c8924068392 Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Wed, 20 Nov 2002 22:16:29 +0100 Subject: [PATCH 3/9] Do-compile: - applied some changes from the 4.0 tree (enable multiple --conf-environment options, add --with-debug, don't add "-max" prefix just because BDB is enabled) --- Build-tools/Do-compile | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile index 067b88888ac..dd082181200 100755 --- a/Build-tools/Do-compile +++ b/Build-tools/Do-compile @@ -14,7 +14,7 @@ $opt_innodb=$opt_bdb=$opt_raid=$opt_libwrap=0; GetOptions( "bdb", "build-thread=i", - "config-env=s", + "config-env=s" => \@config_env, "config-options=s" => \@config_options, "dbd-options=s", "debug", @@ -45,6 +45,7 @@ GetOptions( "use-old-distribution", "user=s", "version-suffix=s", + "with-debug", "with-low-memory", "with-other-libc=s", "with-small-disk", @@ -53,11 +54,6 @@ GetOptions( usage() if ($opt_help); usage() if (!$opt_distribution); -if ($opt_bdb && $opt_version_suffix eq "") -{ - $opt_version_suffix="-max"; -} - if (@make_options > 0) { chomp(@make_options); @@ -70,6 +66,12 @@ if (@config_options > 0) $opt_config_options= join(" ", @config_options); } +if (@config_env > 0) +{ + chomp(@config_env); + $opt_config_env= join(" ", @config_env); +} + chomp($host=`hostname`); $full_host_name=$host; $connect_option= ($opt_tcpip ? "--host=$host" : ""); @@ -208,6 +210,7 @@ if ($opt_stage <= 1) $opt_config_options.= " --disable-shared" if (!$opt_enable_shared); # Default for binary versions $opt_config_options.= " --with-berkeley-db" if ($opt_bdb); $opt_config_options.= " --with-client-ldflags=-all-static" if ($opt_static_client); + $opt_config_options.= " --with-debug" if ($opt_with_debug); $opt_config_options.= " --with-libwrap" if ($opt_libwrap); $opt_config_options.= " --with-low-memory" if ($opt_with_low_memory); $opt_config_options.= " --with-mysqld-ldflags=-all-static" if ($opt_static_server); @@ -258,7 +261,7 @@ if ($opt_stage <= 3) log_system("rm -fr mysql-3* mysql-4* $pwd/$host/*.tar.gz"); log_system("nm -n sql/mysqld | gzip -9 -v 2>&1 > sql/mysqld.sym.gz | cat"); - $flags.= "--no-strip" if ($opt_no_strip); + $flags.= "--no-strip" if ($opt_no_strip || $opt_with_debug); check_system("scripts/make_binary_distribution --tmp=$opt_tmp --suffix=$opt_suffix $flags",".tar.gz created"); safe_system("mv mysql*.tar.gz $pwd/$host"); if (-f "client/.libs/mysqladmin") @@ -500,6 +503,9 @@ If user is empty then no mail is sent. --version-suffix suffix Set name suffix (e.g. 'com' or '-max') for a distribution +--with-debug +Build binaries with debug information (implies "--no-strip") + --with-low-memory Use less memory when compiling. @@ -530,7 +536,7 @@ sub abort print TMP "To: $email\n"; print TMP "Subject: $ver$opt_version_suffix compilation failed\n\n"; close TMP; - system("tail -40 $log > $log.mail"); + system("tail -n 40 $log > $log.mail"); system("cat $mail_header_file $log.mail | $sendmail -t -f $email"); unlink($mail_header_file); unlink("$log.mail"); @@ -606,7 +612,7 @@ sub which my(@progs)=@_; foreach $prog (@progs) { - chomp($found=`which $prog | head -1`); + chomp($found=`which $prog | head -n 1`); if ($? == 0 && $found ne "" && index($found," ") == -1) { $found =~ s|/+|/|g; # Make nicer output From c1fa8f6485450b8f7b1e7cb6083ce7c7f464fca7 Mon Sep 17 00:00:00 2001 From: "Sinisa@sinisa.nasamreza.org" <> Date: Thu, 21 Nov 2002 17:55:49 +0200 Subject: [PATCH 4/9] A fix for --bind-address=hostname --- sql/mysqld.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 71b832f24f4..8d6a1a8a700 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3543,7 +3543,6 @@ static void set_options(void) #endif my_bind_addr = htonl( INADDR_ANY ); } - /* Initiates DEBUG - but no debugging here ! */ static void get_options(int argc,char **argv) @@ -3893,7 +3892,7 @@ static void get_options(int argc,char **argv) else { struct hostent *ent; - if (!optarg || !optarg[0]) + if (optarg && optarg[0]) ent=gethostbyname(optarg); else { From a7fe266e54ae842978baf1662d612f27a1e86d4e Mon Sep 17 00:00:00 2001 From: "Sinisa@sinisa.nasamreza.org" <> Date: Thu, 21 Nov 2002 18:14:27 +0200 Subject: [PATCH 5/9] fix error in result --- mysql-test/r/func_test.result | 1 - 1 file changed, 1 deletion(-) diff --git a/mysql-test/r/func_test.result b/mysql-test/r/func_test.result index da82567db4d..2f40740d4aa 100644 --- a/mysql-test/r/func_test.result +++ b/mysql-test/r/func_test.result @@ -27,7 +27,6 @@ -1.49 or -1.49 0.6 or 0.6 1 1 start ctime1 ctime2 -2002-11-04 00:00:00 20021029165106 20021105164731 start ctime1 ctime2 2002-11-04 00:00:00 20021029165106 20021105164731 5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1 From e1af5fb24d986d1b810415fe31af9fa5c88c4102 Mon Sep 17 00:00:00 2001 From: "monty@mashka.mysql.fi" <> Date: Fri, 22 Nov 2002 13:35:43 +0200 Subject: [PATCH 6/9] Fixed bug with indexed NULL column <=> NULL Fix for Mac OS X shutdown --- mysql-test/mysql-test-run.sh | 3 ++- mysql-test/r/null_key.result | 17 +++++++++++++++++ mysql-test/t/null_key.test | 21 +++++++++++++++++++++ sql/mysqld.cc | 4 ++++ sql/opt_range.cc | 18 ++++++++++++------ 5 files changed, 56 insertions(+), 7 deletions(-) diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 514ef9e704a..fcddf52c66b 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -249,6 +249,7 @@ SLAVE_MYPID="$MYRUN_DIR/mysqld-slave.pid" SLAVE_MYLOG="$MYSQL_TEST_DIR/var/log/mysqld-slave.log" SLAVE_MYERR="$MYSQL_TEST_DIR/var/log/mysqld-slave.err" +CLIENT_MYLOG="$MYSQL_TEST_DIR/var/log/client.log" SMALL_SERVER="-O key_buffer_size=1M -O sort_buffer=256K -O max_heap_table_size=1M" export MASTER_MYPORT @@ -344,7 +345,7 @@ SLAVE_MYSQLD=$MYSQLD #this can be changed later if we are doing gcov #-- wait_for_server_start () { - $MYSQLADMIN --no-defaults -u $DBUSER --silent -O connect_timeout=10 -w3 --host=$hostname --port=$1 ping >/dev/null 2>&1 + $MYSQLADMIN --no-defaults -u $DBUSER --silent -O connect_timeout=10 -w3 --host=$hostname --port=$1 ping >> $CLIENT_MYLOG 2>&1 exit_code=$? if [ $exit_code != 0 ]; then echo "Error: Could not start $2, exit code $exit_code"; diff --git a/mysql-test/r/null_key.result b/mysql-test/r/null_key.result index a0f88b804aa..46bcbebe170 100644 --- a/mysql-test/r/null_key.result +++ b/mysql-test/r/null_key.result @@ -126,3 +126,20 @@ order_id product_id product_type 3d7ce39b5d4b3e3d22aaafe9b633de51 5880836 3 id id id id +id id2 +NULL 0 +1 1 +id id2 +NULL 0 +id id2 +NULL 0 +1 1 +id id2 +NULL 0 +1 1 +id id2 +1 1 +id id2 +1 1 +id id2 +1 1 diff --git a/mysql-test/t/null_key.test b/mysql-test/t/null_key.test index 3ab8b993f43..b1cbd5cdfb0 100644 --- a/mysql-test/t/null_key.test +++ b/mysql-test/t/null_key.test @@ -135,3 +135,24 @@ select * from t1, t2 where t1.id = t2.id; alter table t1 add key id (id); select * from t1, t2 where t1.id = t2.id; drop table t1,t2; + +# +# Check bug when doing <=> NULL on an indexed null field +# + +create table t1 ( + id integer, + id2 integer not null, + index (id), + index (id2) +); +insert into t1 values(null,null),(1,1); +select * from t1; +select * from t1 where id <=> null; +select * from t1 where id <=> null or id > 0; +select * from t1 where id is null or id > 0; +select * from t1 where id2 <=> null or id2 > 0; +select * from t1 where id2 is null or id2 > 0; +delete from t1 where id <=> NULL; +select * from t1; +drop table t1; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 71b832f24f4..7a33a3cfc49 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -739,7 +739,11 @@ static sig_handler print_signal_warning(int sig) void unireg_end(int signal_number __attribute__((unused))) { clean_up(); +#ifdef SIGNALS_DONT_BREAK_READ + exit(0); +#else pthread_exit(0); // Exit is in main thread +#endif } diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 42f20c0f767..0645fe15df3 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -931,8 +931,11 @@ get_mm_leaf(Field *field,KEY_PART *key_part, if (!(res= value->val_str(&tmp))) DBUG_RETURN(&null_element); - // Check if this was a function. This should have be optimized away - // in the sql_select.cc + /* + TODO: + Check if this was a function. This should have be optimized away + in the sql_select.cc + */ if (res != &tmp) { tmp.copy(*res); // Get own copy @@ -1011,8 +1014,10 @@ get_mm_leaf(Field *field,KEY_PART *key_part, type != Item_func::EQUAL_FUNC) DBUG_RETURN(0); // Can't optimize this - /* We can't always use indexes when comparing a string index to a number */ - /* cmp_type() is checked to allow compare of dates to numbers */ + /* + We can't always use indexes when comparing a string index to a number + cmp_type() is checked to allow compare of dates to numbers + */ if (field->result_type() == STRING_RESULT && value->result_type() != STRING_RESULT && field->cmp_type() != value->result_type()) @@ -1020,6 +1025,7 @@ get_mm_leaf(Field *field,KEY_PART *key_part, if (value->save_in_field(field)) { + /* This happens when we try to insert a NULL field in a not null column */ if (type == Item_func::EQUAL_FUNC) { /* convert column_name <=> NULL -> column_name IS NULL */ @@ -1029,14 +1035,14 @@ get_mm_leaf(Field *field,KEY_PART *key_part, *str = 1; DBUG_RETURN(new SEL_ARG(field,str,str)); } - DBUG_RETURN(&null_element); // NULL is never true + DBUG_RETURN(&null_element); // cmp with NULL is never true } // Get local copy of key char *str= (char*) sql_alloc(key_part->part_length+maybe_null); if (!str) DBUG_RETURN(0); if (maybe_null) - *str=0; // Not NULL + *str= (char) field->is_real_null(); // Set to 1 if null field->get_key_image(str+maybe_null,key_part->part_length); if (!(tree=new SEL_ARG(field,str,str))) DBUG_RETURN(0); From 48e94ed0ca368132b594f0b9dfc9110499f2d747 Mon Sep 17 00:00:00 2001 From: "monty@mashka.mysql.fi" <> Date: Fri, 22 Nov 2002 13:52:40 +0200 Subject: [PATCH 7/9] Moved test to correct file --- mysql-test/r/func_test.result | 3 --- mysql-test/r/func_time.result | 5 +++++ mysql-test/t/func_test.test | 10 ---------- mysql-test/t/func_time.test | 18 ++++++++++++++++++ 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/mysql-test/r/func_test.result b/mysql-test/r/func_test.result index 2f40740d4aa..586e345ea10 100644 --- a/mysql-test/r/func_test.result +++ b/mysql-test/r/func_test.result @@ -26,9 +26,6 @@ 1 1 1 -1.49 or -1.49 0.6 or 0.6 1 1 -start ctime1 ctime2 -start ctime1 ctime2 -2002-11-04 00:00:00 20021029165106 20021105164731 5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1 0 1 1 and 2 between 2 and 10 2 between 2 and 10 and 1 diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 71fc7e4b90b..a77d9b2cdff 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -220,3 +220,8 @@ to_days("0000-00-00") to_days(d) to_days(dt) to_days(t) to_days(c) NULL NULL NULL NULL NULL extract(MONTH FROM "0000-00-00") extract(MONTH FROM d) extract(MONTH FROM dt) extract(MONTH FROM t) extract(MONTH FROM c) 0 0 0 0 0 +start ctime1 ctime2 +start ctime1 ctime2 +2002-11-04 00:00:00 20021029165106 20021105164731 +start ctime1 ctime2 +2002-11-04 00:00:00 2002-10-29 16:51:06 2002-11-05 16:47:31 diff --git a/mysql-test/t/func_test.test b/mysql-test/t/func_test.test index ccbb531e2e6..ec44009b1a6 100644 --- a/mysql-test/t/func_test.test +++ b/mysql-test/t/func_test.test @@ -15,16 +15,6 @@ select 2 between 1 and 3, "monty" between "max" and "my",2=2 and "monty" between select 'b' between 'a' and 'c', 'B' between 'a' and 'c'; select 2 in (3,2,5,9,5,1),"monty" in ("david","monty","allan"), 1.2 in (1.4,1.2,1.0); select -1.49 or -1.49,0.6 or 0.6; -drop table if exists t1,t2; -CREATE TABLE t1 ( start datetime default NULL) TYPE=MyISAM; -INSERT INTO t1 VALUES ('2002-10-21 00:00:00'); -INSERT INTO t1 VALUES ('2002-10-28 00:00:00'); -INSERT INTO t1 VALUES ('2002-11-04 00:00:00'); -CREATE TABLE t2 ( ctime1 timestamp(14) NOT NULL, ctime2 timestamp(14) NOT NULL) TYPE=MyISAM; -INSERT INTO t2 VALUES (20021029165106,20021105164731); -select * from t1, t2 where t1.start between t2.ctime1 and t2.ctime2; -select * from t1, t2 where t1.start >= t2.ctime1 and t1.start <= t2.ctime2; -drop table if exists t1,t2; # # Wrong usage of functions diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index ffb0f8bbf1e..e267339d64c 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -150,3 +150,21 @@ select yearweek("0000-00-00"),yearweek(d),yearweek(dt),yearweek(t),yearweek(c) f select to_days("0000-00-00"),to_days(d),to_days(dt),to_days(t),to_days(c) from t1; select extract(MONTH FROM "0000-00-00"),extract(MONTH FROM d),extract(MONTH FROM dt),extract(MONTH FROM t),extract(MONTH FROM c) from t1; drop table t1; + + +# +# Test problem with TIMESTAMP and BETWEEN +# + +CREATE TABLE t1 ( start datetime default NULL); +INSERT INTO t1 VALUES ('2002-10-21 00:00:00'),('2002-10-28 00:00:00'),('2002-11-04 00:00:00'); +CREATE TABLE t2 ( ctime1 timestamp(14) NOT NULL, ctime2 timestamp(14) NOT NULL); +INSERT INTO t2 VALUES (20021029165106,20021105164731); +CREATE TABLE t3 (ctime1 char(19) NOT NULL, ctime2 char(19) NOT NULL); +INSERT INTO t3 VALUES ("2002-10-29 16:51:06","2002-11-05 16:47:31"); + +# The following statement should be fixed to return a row in 4.1 +select * from t1, t2 where t1.start between t2.ctime1 and t2.ctime2; +select * from t1, t2 where t1.start >= t2.ctime1 and t1.start <= t2.ctime2; +select * from t1, t3 where t1.start between t3.ctime1 and t3.ctime2; +drop table t1,t2,t3; From d882391975129b57f4f800f902cc580abd46c03b Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Fri, 22 Nov 2002 18:26:45 +0100 Subject: [PATCH 8/9] scripts/safe_mysqld.sh - fix setting of niceness level support-files/mysql.server.sh - applied some fixes from 4.0 mysql.server script - fix my.cnf parsing --- scripts/safe_mysqld.sh | 2 +- support-files/mysql.server.sh | 40 +++++++++++++++++++++++------------ 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/scripts/safe_mysqld.sh b/scripts/safe_mysqld.sh index 2b625dbdfa3..2272443c972 100644 --- a/scripts/safe_mysqld.sh +++ b/scripts/safe_mysqld.sh @@ -159,7 +159,7 @@ then NOHUP_NICENESS=`nohup nice 2>&1` if test $? -eq 0 && test x"$NOHUP_NICENESS" != x0 && nice --1 echo foo > /dev/null 2>&1 then - NOHUP_NICENESS="nice --$NOHUP_NICENESS nohup" + NOHUP_NICENESS="nice -n $NOHUP_NICENESS nohup" else NOHUP_NICENESS="nohup" fi diff --git a/support-files/mysql.server.sh b/support-files/mysql.server.sh index ecc49106c91..91821fd09e5 100644 --- a/support-files/mysql.server.sh +++ b/support-files/mysql.server.sh @@ -2,7 +2,7 @@ # Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB # This file is public domain and comes with NO WARRANTY of any kind -# Mysql daemon start/stop script. +# MySQL daemon start/stop script. # Usually this is put in /etc/init.d (at least on machines SYSV R4 based # systems) and linked to /etc/rc3.d/S99mysql and /etc/rc0.d/K01mysql. @@ -20,21 +20,31 @@ # Required-Stop: $local_fs $network $remote_fs # Default-Start: 3 5 # Default-Stop: 3 5 -# Short-Description: start and stop MySLQ +# Short-Description: start and stop MySQL # Description: MySQL is a very fast and reliable SQL database engine. ### END INIT INFO +# If you install MySQL on some other places than @prefix@, then you +# have to do one of the following things for this script to work: +# +# - Run this script from within the MySQL installation directory +# - Create a /etc/my.cnf file with the following information: +# [mysqld] +# basedir= +# - Add the above to any other configuration file (for example ~/.my.ini) +# and copy my_print_defaults to /usr/bin +# - Add the path to the mysql-installation-directory to the basedir variable +# below. +# +# If you want to affect other MySQL variables, you should make your changes +# in the /etc/my.cnf, ~/.my.cnf or other MySQL configuration files. + +basedir= # The following variables are only set for letting mysql.server find things. -# If you want to affect other MySQL variables, you should make your changes -# in the /etc/my.cnf or other configuration files. - -PATH=/sbin:/usr/sbin:/bin:/usr/bin -export PATH # Set some defaults datadir=@localstatedir@ -basedir= pid_file= if test -z "$basedir" then @@ -43,6 +53,10 @@ then else bindir="$basedir/bin" fi + +PATH=/sbin:/usr/sbin:/bin:/usr/bin:$basedir/bin +export PATH + if test -z "$pid_file" then pid_file=$datadir/`@HOSTNAME@`.pid @@ -65,7 +79,7 @@ parse_arguments() { done } -# Get arguments from the my.cnf file, groups [mysqld] and [mysql_server] +# Get arguments from the my.cnf file, groups [mysqld] and [mysql.server] if test -x ./bin/my_print_defaults then print_defaults="./bin/my_print_defaults" @@ -103,7 +117,7 @@ else test -z "$print_defaults" && print_defaults="my_print_defaults" fi -parse_arguments `$print_defaults $defaults mysqld mysql_server` +parse_arguments `$print_defaults $defaults mysqld mysql.server` # Safeguard (relative paths, core dumps..) cd $basedir @@ -123,14 +137,14 @@ case "$mode" in touch /var/lock/subsys/mysql fi else - echo "Can't execute $bindir/safe_mysqld" + echo "Can't execute $bindir/safe_mysqld from dir $basedir" fi ;; 'stop') # Stop daemon. We use a signal here to avoid having to know the # root password. - if test -f "$pid_file" + if test -s "$pid_file" then mysqld_pid=`cat $pid_file` echo "Killing mysqld with pid $mysqld_pid" @@ -140,7 +154,7 @@ case "$mode" in sleep 1 while [ -s $pid_file -a "$flags" != aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ] do - [ -z "$flags" ] && echo "Wait for mysqld to exit\c" || echo ".\c" + [ -z "$flags" ] && echo -n "Wait for mysqld to exit" || echo -n "." flags=a$flags sleep 1 done From 4575594e1a2d02cc7b8762fca56d8cafe6054dac Mon Sep 17 00:00:00 2001 From: "monty@mashka.mysql.fi" <> Date: Sun, 24 Nov 2002 16:20:41 +0200 Subject: [PATCH 9/9] Rewrote nice handling to make more portable --- scripts/safe_mysqld.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/safe_mysqld.sh b/scripts/safe_mysqld.sh index 2272443c972..96568bd5d19 100644 --- a/scripts/safe_mysqld.sh +++ b/scripts/safe_mysqld.sh @@ -157,9 +157,14 @@ NOHUP_NICENESS="nohup" if test -w / then NOHUP_NICENESS=`nohup nice 2>&1` - if test $? -eq 0 && test x"$NOHUP_NICENESS" != x0 && nice --1 echo foo > /dev/null 2>&1 - then - NOHUP_NICENESS="nice -n $NOHUP_NICENESS nohup" + if test $? -eq 0 && test x"$NOHUP_NICENESS" != x0 && nice --1 echo foo > /dev/null 2>&1 + then + if $NOHUP_NICENESS -gt 0 + then + $NOHUP_NICENESS="nice --$NOHUP_NICENESS nohup" + else + NOHUP_NICENESS="nice -$NOHUP_NICENESS nohup" + fi else NOHUP_NICENESS="nohup" fi