From 4600fc3f34a2ddd999b8c9f2c323dd828056edba Mon Sep 17 00:00:00 2001 From: "msvensson@pilot.mysql.com" <> Date: Fri, 2 May 2008 09:13:43 +0200 Subject: [PATCH 1/4] Bug#36463 mysql-test-run.pl should always use the --tmpdi --- mysql-test/mysql-test-run.pl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 7c4677b8274..829941545cd 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1367,7 +1367,15 @@ sub datadir_list_setup () { sub collect_mysqld_features () { my $found_variable_list_start= 0; - my $tmpdir= tempdir(CLEANUP => 0); # Directory removed by this function + my $tmpdir; + if ( $opt_tmpdir ) { + # Use the requested tmpdir + mkpath($opt_tmpdir) if (! -d $opt_tmpdir); + $tmpdir= $opt_tmpdir; + } + else { + $tmpdir= tempdir(CLEANUP => 0); # Directory removed by this function + } # # Execute "mysqld --no-defaults --help --verbose" to get a @@ -1428,7 +1436,7 @@ sub collect_mysqld_features () { } } } - rmtree($tmpdir); + rmtree($tmpdir) if (!$opt_tmpdir); mtr_error("Could not find version of MySQL") unless $mysql_version_id; mtr_error("Could not find variabes list") unless $found_variable_list_start; From c1918b0464dcc4bc82cc1207b3a9189d3e7e2139 Mon Sep 17 00:00:00 2001 From: "msvensson@pilot.mysql.com" <> Date: Fri, 2 May 2008 11:22:10 +0200 Subject: [PATCH 2/4] Bug#36465 mysqltest should always use the --tmpdir --- client/mysqltest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/mysqltest.c b/client/mysqltest.c index 1d85e777e48..a04f18750ef 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -1536,7 +1536,7 @@ int dyn_string_cmp(DYNAMIC_STRING* ds, const char *fname) DBUG_ENTER("dyn_string_cmp"); DBUG_PRINT("enter", ("fname: %s", fname)); - if ((fd= create_temp_file(temp_file_path, NULL, + if ((fd= create_temp_file(temp_file_path, TMPDIR, "tmp", O_CREAT | O_SHARE | O_RDWR, MYF(MY_WME))) < 0) die("Failed to create temporary file for ds"); From 4cede4a3bf0003f69aad46803930122e5c47f413 Mon Sep 17 00:00:00 2001 From: "msvensson@pilot.mysql.com" <> Date: Fri, 2 May 2008 12:49:31 +0200 Subject: [PATCH 3/4] Bug#35986 valgrind warning in DbugParse for empty string in SET GLOBAL DEBUG="" - Code in DbugParse was reading from beyond end of the control string --- dbug/dbug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbug/dbug.c b/dbug/dbug.c index 09515dc329c..baf080f5e27 100644 --- a/dbug/dbug.c +++ b/dbug/dbug.c @@ -493,7 +493,7 @@ static void DbugParse(CODE_STATE *cs, const char *control) } end= DbugStrTok(control); - while (1) + while (control < end) { int c, sign= (*control == '+') ? 1 : (*control == '-') ? -1 : 0; if (sign) control++; From e549ba80679e90b4b518e513a22004d4008d8381 Mon Sep 17 00:00:00 2001 From: "msvensson@pilot.mysql.com" <> Date: Fri, 2 May 2008 14:41:19 +0200 Subject: [PATCH 4/4] Bug#36469 mysql_upgrade does not use --tmpdir --- client/mysql_upgrade.c | 11 ++++++++++- mysql-test/mysql-test-run.pl | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 02829cd2178..ded9d465d3a 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -40,6 +40,8 @@ static DYNAMIC_STRING ds_args; static char *opt_password= 0; static my_bool tty_password= 0; +static char opt_tmpdir[FN_REFLEN]; + #ifndef DBUG_OFF static char *default_dbug_option= (char*) "d:t:O,/tmp/mysql_upgrade.trace"; #endif @@ -105,6 +107,8 @@ static struct my_option my_long_options[]= #endif {"socket", 'S', "Socket file to use for connection.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"tmpdir", 't', "Directory for temporary files", + 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"user", 'u', "User for login if not current user.", (gptr*) &opt_user, (gptr*) &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #include @@ -229,6 +233,11 @@ get_one_option(int optid, const struct my_option *opt, } break; + case 't': + strnmov(opt_tmpdir, argument, sizeof(opt_tmpdir)); + add_option= FALSE; + break; + case 'b': /* --basedir */ case 'v': /* --verbose */ case 'd': /* --datadir */ @@ -449,7 +458,7 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res, char query_file_path[FN_REFLEN]; DBUG_ENTER("run_query"); DBUG_PRINT("enter", ("query: %s", query)); - if ((fd= create_temp_file(query_file_path, NULL, + if ((fd= create_temp_file(query_file_path, opt_tmpdir, "sql", O_CREAT | O_SHARE | O_RDWR, MYF(MY_WME))) < 0) die("Failed to create temporary file for defaults"); diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 829941545cd..d123fa03201 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1745,6 +1745,7 @@ sub mysql_upgrade_arguments() mtr_add_arg($args, "--socket=$master->[0]->{'path_sock'}"); mtr_add_arg($args, "--datadir=$master->[0]->{'path_myddir'}"); mtr_add_arg($args, "--basedir=$glob_basedir"); + mtr_add_arg($args, "--tmpdir=$opt_tmpdir"); if ( $opt_debug ) {