Commit 030b524c authored by Ondrej Sury's avatar Ondrej Sury
Browse files

New upstream version 10.1.23

parent a6063b4a
...@@ -46,6 +46,8 @@ extra/comp_err ...@@ -46,6 +46,8 @@ extra/comp_err
extra/innochecksum extra/innochecksum
extra/jemalloc/build/ extra/jemalloc/build/
extra/jemalloc/tmp/ extra/jemalloc/tmp/
extra/mariabackup/mariabackup
extra/mariabackup/mbstream
extra/my_print_defaults extra/my_print_defaults
extra/mysql_waitpid extra/mysql_waitpid
extra/mysqld_safe_helper extra/mysqld_safe_helper
...@@ -91,6 +93,9 @@ pcre/pcre_chartables.c ...@@ -91,6 +93,9 @@ pcre/pcre_chartables.c
pcre/pcregrep pcre/pcregrep
pcre/pcretest pcre/pcretest
pcre/test*grep pcre/test*grep
plugin/aws_key_management/aws-sdk-cpp
plugin/aws_key_management/aws_sdk_cpp
plugin/aws_key_management/aws_sdk_cpp-prefix
scripts/comp_sql scripts/comp_sql
scripts/make_binary_distribution scripts/make_binary_distribution
scripts/msql2mysql scripts/msql2mysql
...@@ -115,6 +120,7 @@ scripts/mytop ...@@ -115,6 +120,7 @@ scripts/mytop
scripts/wsrep_sst_common scripts/wsrep_sst_common
scripts/wsrep_sst_mysqldump scripts/wsrep_sst_mysqldump
scripts/wsrep_sst_rsync scripts/wsrep_sst_rsync
scripts/wsrep_sst_mariabackup
scripts/wsrep_sst_xtrabackup scripts/wsrep_sst_xtrabackup
scripts/wsrep_sst_xtrabackup-v2 scripts/wsrep_sst_xtrabackup-v2
scripts/maria_add_gis_sp.sql scripts/maria_add_gis_sp.sql
...@@ -235,6 +241,10 @@ storage/mroonga/vendor/groonga/src/groonga-benchmark ...@@ -235,6 +241,10 @@ storage/mroonga/vendor/groonga/src/groonga-benchmark
storage/mroonga/vendor/groonga/src/suggest/groonga-suggest-create-dataset storage/mroonga/vendor/groonga/src/suggest/groonga-suggest-create-dataset
storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result
storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result
xxx/*
yyy/*
zzz/*
# C and C++ # C and C++
# Compiled Object files # Compiled Object files
......
# Copyright (c) 2006, 2014, Oracle and/or its affiliates. # Copyright (c) 2006, 2017, Oracle and/or its affiliates.
# Copyright (c) 2008, 2014, Monty Program Ab # Copyright (c) 2008, 2017, MariaDB
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
...@@ -223,11 +223,9 @@ IF(SECURITY_HARDENED) ...@@ -223,11 +223,9 @@ IF(SECURITY_HARDENED)
MY_CHECK_AND_SET_COMPILER_FLAG("-D_FORTIFY_SOURCE=2" RELEASE RELWITHDEBINFO) MY_CHECK_AND_SET_COMPILER_FLAG("-D_FORTIFY_SOURCE=2" RELEASE RELWITHDEBINFO)
ENDIF() ENDIF()
OPTION(ENABLE_DEBUG_SYNC "Enable debug sync (debug builds only)" ON) # Always enable debug sync for debug builds.
IF(ENABLE_DEBUG_SYNC) SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
ENDIF()
OPTION(ENABLE_GCOV "Enable gcov (debug, Linux builds only)" OFF) OPTION(ENABLE_GCOV "Enable gcov (debug, Linux builds only)" OFF)
IF (ENABLE_GCOV) IF (ENABLE_GCOV)
...@@ -467,8 +465,9 @@ ADD_CUSTOM_TARGET(INFO_BIN ALL ...@@ -467,8 +465,9 @@ ADD_CUSTOM_TARGET(INFO_BIN ALL
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
) )
INSTALL_DOCUMENTATION(README CREDITS COPYING COPYING.LESSER COPYING.thirdparty INSTALL_DOCUMENTATION(README CREDITS COPYING COPYING.thirdparty
EXCEPTIONS-CLIENT COMPONENT Readme) EXCEPTIONS-CLIENT COMPONENT Readme)
# MDEV-6526 these files are not installed anymore # MDEV-6526 these files are not installed anymore
#INSTALL_DOCUMENTATION(${CMAKE_BINARY_DIR}/Docs/INFO_SRC #INSTALL_DOCUMENTATION(${CMAKE_BINARY_DIR}/Docs/INFO_SRC
# ${CMAKE_BINARY_DIR}/Docs/INFO_BIN) # ${CMAKE_BINARY_DIR}/Docs/INFO_BIN)
......
This diff is collapsed.
commit: 68be011cf2ec96a622db857fe9c418380d106d0d commit: acce1f37c2518278a31606c7f1b460ad0ac7347c
date: 2017-03-11 20:59:52 +0200 date: 2017-05-02 08:09:16 +0300
build-date: 2017-03-11 20:09:31 +0100 build-date: 2017-05-02 07:13:55 +0200
short: 68be011 short: acce1f3
branch: HEAD branch: HEAD
MariaDB source 10.1.22 MariaDB source 10.1.23
MYSQL_VERSION_MAJOR=10 MYSQL_VERSION_MAJOR=10
MYSQL_VERSION_MINOR=1 MYSQL_VERSION_MINOR=1
MYSQL_VERSION_PATCH=22 MYSQL_VERSION_PATCH=23
...@@ -115,4 +115,3 @@ enum options_client ...@@ -115,4 +115,3 @@ enum options_client
Name of the performance schema database. Name of the performance schema database.
*/ */
#define PERFORMANCE_SCHEMA_DB_NAME "performance_schema" #define PERFORMANCE_SCHEMA_DB_NAME "performance_schema"
/* /*
Copyright (c) 2000, 2014, Oracle and/or its affiliates. Copyright (c) 2000, 2014, Oracle and/or its affiliates.
Copyright (c) 2009, 2016, MariaDB Copyright (c) 2009, 2017, MariaDB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
......
/* /*
Copyright (c) 2006, 2013, Oracle and/or its affiliates. Copyright (c) 2006, 2013, Oracle and/or its affiliates.
Copyright (c) 2010, 2016, MariaDB Copyright (c) 2010, 2017, MariaDB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
......
/* /*
Copyright (c) 2000, 2014, Oracle and/or its affiliates. Copyright (c) 2000, 2014, Oracle and/or its affiliates.
Copyright (c) 2010, 2016, MariaDB Copyright (c) 2010, 2017, MariaDB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
......
/* /*
Copyright (c) 2001, 2013, Oracle and/or its affiliates. Copyright (c) 2001, 2013, Oracle and/or its affiliates.
Copyright (c) 2010, 2016, MariaDB Copyright (c) 2010, 2017, MariaDB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
......
/* /*
Copyright (c) 2000, 2013, Oracle and/or its affiliates. Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2010, 2016, MariaDB Copyright (c) 2010, 2017, MariaDB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -2205,7 +2205,6 @@ static void print_comment(FILE *sql_file, my_bool is_error, const char *format, ...@@ -2205,7 +2205,6 @@ static void print_comment(FILE *sql_file, my_bool is_error, const char *format,
print_xml_comment(sql_file, strlen(comment_buff), comment_buff); print_xml_comment(sql_file, strlen(comment_buff), comment_buff);
} }
/* /*
create_delimiter create_delimiter
Generate a new (null-terminated) string that does not exist in query Generate a new (null-terminated) string that does not exist in query
...@@ -2550,7 +2549,7 @@ static uint dump_routines_for_db(char *db) ...@@ -2550,7 +2549,7 @@ static uint dump_routines_for_db(char *db)
query_buff); query_buff);
print_comment(sql_file, 1, print_comment(sql_file, 1,
"-- does %s have permissions on mysql.proc?\n\n", "-- does %s have permissions on mysql.proc?\n\n",
current_user); fix_for_comment(current_user));
maybe_die(EX_MYSQLERR,"%s has insufficent privileges to %s!", maybe_die(EX_MYSQLERR,"%s has insufficent privileges to %s!",
current_user, query_buff); current_user, query_buff);
} }
......
/* /*
Copyright (c) 2000, 2015, Oracle and/or its affiliates. Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2011, 2016, MariaDB Copyright (c) 2011, 2017, MariaDB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
......
/* /*
Copyright (c) 2000, 2015, Oracle and/or its affiliates. Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2010, 2016, MariaDB Copyright (c) 2010, 2017, MariaDB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
......
/* /*
Copyright (c) 2005, 2015, Oracle and/or its affiliates. Copyright (c) 2005, 2015, Oracle and/or its affiliates.
Copyright (c) 2010, 2016, MariaDB Copyright (c) 2010, 2017, MariaDB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
......
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. /* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2009, 2016, Monty Program Ab. Copyright (c) 2009, 2017, MariaDB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -1062,7 +1062,7 @@ void do_eval(DYNAMIC_STRING *query_eval, const char *query, ...@@ -1062,7 +1062,7 @@ void do_eval(DYNAMIC_STRING *query_eval, const char *query,
if (!(v= var_get(p, &p, 0, 0))) if (!(v= var_get(p, &p, 0, 0)))
{ {
report_or_die( "Bad variable in eval"); report_or_die( "Bad variable in eval");
return; DBUG_VOID_RETURN;
} }
dynstr_append_mem(query_eval, v->str_val, v->str_val_len); dynstr_append_mem(query_eval, v->str_val, v->str_val_len);
} }
...@@ -1777,7 +1777,7 @@ static int run_command(char* cmd, ...@@ -1777,7 +1777,7 @@ static int run_command(char* cmd,
if (!(res_file= popen(cmd, "r"))) if (!(res_file= popen(cmd, "r")))
{ {
report_or_die("popen(\"%s\", \"r\") failed", cmd); report_or_die("popen(\"%s\", \"r\") failed", cmd);
return -1; DBUG_RETURN(-1);
} }
while (fgets(buf, sizeof(buf), res_file)) while (fgets(buf, sizeof(buf), res_file))
...@@ -2874,7 +2874,7 @@ void var_set_query_get_value(struct st_command *command, VAR *var) ...@@ -2874,7 +2874,7 @@ void var_set_query_get_value(struct st_command *command, VAR *var)
dynstr_free(&ds_query); dynstr_free(&ds_query);
dynstr_free(&ds_col); dynstr_free(&ds_col);
eval_expr(var, "", 0); eval_expr(var, "", 0);
return; DBUG_VOID_RETURN;
} }
{ {
...@@ -2899,7 +2899,7 @@ void var_set_query_get_value(struct st_command *command, VAR *var) ...@@ -2899,7 +2899,7 @@ void var_set_query_get_value(struct st_command *command, VAR *var)
ds_col.str, ds_query.str); ds_col.str, ds_query.str);
dynstr_free(&ds_query); dynstr_free(&ds_query);
dynstr_free(&ds_col); dynstr_free(&ds_col);
return; DBUG_VOID_RETURN;
} }
DBUG_PRINT("info", ("Found column %d with name '%s'", DBUG_PRINT("info", ("Found column %d with name '%s'",
i, fields[i].name)); i, fields[i].name));
...@@ -3347,7 +3347,7 @@ void do_exec(struct st_command *command) ...@@ -3347,7 +3347,7 @@ void do_exec(struct st_command *command)
if (!*cmd) if (!*cmd)
{ {
report_or_die("Missing argument in exec"); report_or_die("Missing argument in exec");
return; DBUG_VOID_RETURN;
} }
command->last_argument= command->end; command->last_argument= command->end;
...@@ -3373,6 +3373,12 @@ void do_exec(struct st_command *command) ...@@ -3373,6 +3373,12 @@ void do_exec(struct st_command *command)
#endif #endif
#endif #endif
if (disable_result_log)
{
/* Collect stderr output as well, for the case app. crashes or returns error.*/
dynstr_append(&ds_cmd, " 2>&1");
}
DBUG_PRINT("info", ("Executing '%s' as '%s'", DBUG_PRINT("info", ("Executing '%s' as '%s'",
command->first_argument, ds_cmd.str)); command->first_argument, ds_cmd.str));
...@@ -3381,7 +3387,7 @@ void do_exec(struct st_command *command) ...@@ -3381,7 +3387,7 @@ void do_exec(struct st_command *command)
dynstr_free(&ds_cmd); dynstr_free(&ds_cmd);
if (command->abort_on_error) if (command->abort_on_error)
report_or_die("popen(\"%s\", \"r\") failed", command->first_argument); report_or_die("popen(\"%s\", \"r\") failed", command->first_argument);
return; DBUG_VOID_RETURN;
} }
ds_result= &ds_res; ds_result= &ds_res;
...@@ -3408,16 +3414,7 @@ void do_exec(struct st_command *command) ...@@ -3408,16 +3414,7 @@ void do_exec(struct st_command *command)
len--; len--;
} }
#endif #endif
if (disable_result_log) replace_dynstr_append_mem(ds_result, buf, len);
{
if (len)
buf[len-1] = 0;
DBUG_PRINT("exec_result",("%s", buf));
}
else
{
replace_dynstr_append_mem(ds_result, buf, len);
}
} }
error= pclose(res_file); error= pclose(res_file);
...@@ -3427,7 +3424,7 @@ void do_exec(struct st_command *command) ...@@ -3427,7 +3424,7 @@ void do_exec(struct st_command *command)
dynstr_free(&ds_sorted); dynstr_free(&ds_sorted);
} }
if (error > 0) if (error)
{ {
uint status= WEXITSTATUS(error); uint status= WEXITSTATUS(error);
int i; int i;
...@@ -3439,7 +3436,7 @@ void do_exec(struct st_command *command) ...@@ -3439,7 +3436,7 @@ void do_exec(struct st_command *command)
ds_cmd.str, error, status, errno, ds_cmd.str, error, status, errno,
ds_res.str); ds_res.str);
dynstr_free(&ds_cmd); dynstr_free(&ds_cmd);
return; DBUG_VOID_RETURN;
} }
DBUG_PRINT("info", DBUG_PRINT("info",
...@@ -3473,6 +3470,12 @@ void do_exec(struct st_command *command) ...@@ -3473,6 +3470,12 @@ void do_exec(struct st_command *command)
} }
dynstr_free(&ds_cmd); dynstr_free(&ds_cmd);
if (disable_result_log)
{
/* Disable output in case of successful exit.*/
dynstr_set(&ds_res,"");
}
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -3572,7 +3575,7 @@ void do_system(struct st_command *command) ...@@ -3572,7 +3575,7 @@ void do_system(struct st_command *command)
if (strlen(command->first_argument) == 0) if (strlen(command->first_argument) == 0)
{ {
report_or_die("Missing arguments to system, nothing to do!"); report_or_die("Missing arguments to system, nothing to do!");
return; DBUG_VOID_RETURN;
} }
init_dynamic_string(&ds_cmd, 0, command->query_len + 64, 256); init_dynamic_string(&ds_cmd, 0, command->query_len + 64, 256);
...@@ -3610,6 +3613,37 @@ void do_system(struct st_command *command) ...@@ -3610,6 +3613,37 @@ void do_system(struct st_command *command)
} }
/* returns TRUE if path is inside a sandbox */
bool is_sub_path(const char *path, size_t plen, const char *sandbox)
{
size_t len= strlen(sandbox);
if (!sandbox || !len || plen <= len || memcmp(path, sandbox, len - 1)
|| path[len] != '/')
return false;
return true;
}
/* returns TRUE if path cannot be modified */
bool bad_path(const char *path)
{
size_t plen= strlen(path);
const char *vardir= getenv("MYSQLTEST_VARDIR");
if (is_sub_path(path, plen, vardir))
return false;
const char *tmpdir= getenv("MYSQL_TMP_DIR");
if (is_sub_path(path, plen, tmpdir))
return false;
report_or_die("Path '%s' is not a subdirectory of MYSQLTEST_VARDIR '%s'"
"or MYSQL_TMP_DIR '%s'",
path, vardir, tmpdir);
return true;
}
/* /*
SYNOPSIS SYNOPSIS
set_wild_chars set_wild_chars
...@@ -3668,6 +3702,9 @@ void do_remove_file(struct st_command *command) ...@@ -3668,6 +3702,9 @@ void do_remove_file(struct st_command *command)
rm_args, sizeof(rm_args)/sizeof(struct command_arg), rm_args, sizeof(rm_args)/sizeof(struct command_arg),
' '); ' ');
if (bad_path(ds_filename.str))
DBUG_VOID_RETURN;
DBUG_PRINT("info", ("removing file: %s", ds_filename.str)); DBUG_PRINT("info", ("removing file: %s", ds_filename.str));
error= my_delete(ds_filename.str, MYF(disable_warnings ? 0 : MY_WME)) != 0; error= my_delete(ds_filename.str, MYF(disable_warnings ? 0 : MY_WME)) != 0;
handle_command_error(command, error, my_errno); handle_command_error(command, error, my_errno);
...@@ -3711,6 +3748,9 @@ void do_remove_files_wildcard(struct st_command *command) ...@@ -3711,6 +3748,9 @@ void do_remove_files_wildcard(struct st_command *command)
' '); ' ');
fn_format(dirname, ds_directory.str, "", "", MY_UNPACK_FILENAME); fn_format(dirname, ds_directory.str, "", "", MY_UNPACK_FILENAME);
if (bad_path(ds_directory.str))
DBUG_VOID_RETURN;
DBUG_PRINT("info", ("listing directory: %s", dirname)); DBUG_PRINT("info", ("listing directory: %s", dirname));
if (!(dir_info= my_dir(dirname, MYF(MY_DONT_SORT | MY_WANT_STAT | MY_WME)))) if (!(dir_info= my_dir(dirname, MYF(MY_DONT_SORT | MY_WANT_STAT | MY_WME))))
{ {
...@@ -3785,6 +3825,9 @@ void do_copy_file(struct st_command *command) ...@@ -3785,6 +3825,9 @@ void do_copy_file(struct st_command *command)
sizeof(copy_file_args)/sizeof(struct command_arg), sizeof(copy_file_args)/sizeof(struct command_arg),
' '); ' ');
if (bad_path(ds_to_file.str))
DBUG_VOID_RETURN;
DBUG_PRINT("info", ("Copy %s to %s", ds_from_file.str, ds_to_file.str)); DBUG_PRINT("info", ("Copy %s to %s", ds_from_file.str, ds_to_file.str));
/* MY_HOLD_ORIGINAL_MODES prevents attempts to chown the file */ /* MY_HOLD_ORIGINAL_MODES prevents attempts to chown the file */
error= (my_copy(ds_from_file.str, ds_to_file.str, error= (my_copy(ds_from_file.str, ds_to_file.str,
...@@ -3822,6 +3865,9 @@ void do_move_file(struct st_command *command) ...@@ -3822,6 +3865,9 @@ void do_move_file(struct st_command *command)
sizeof(move_file_args)/sizeof(struct command_arg), sizeof(move_file_args)/sizeof(struct command_arg),
' '); ' ');
if (bad_path(ds_to_file.str))
DBUG_VOID_RETURN;
DBUG_PRINT("info", ("Move %s to %s", ds_from_file.str, ds_to_file.str)); DBUG_PRINT("info", ("Move %s to %s", ds_from_file.str, ds_to_file.str));
error= (my_rename(ds_from_file.str, ds_to_file.str, error= (my_rename(ds_from_file.str, ds_to_file.str,
MYF(disable_warnings ? 0 : MY_WME)) != 0); MYF(disable_warnings ? 0 : MY_WME)) != 0);
...@@ -3860,6 +3906,9 @@ void do_chmod_file(struct st_command *command) ...@@ -3860,6 +3906,9 @@ void do_chmod_file(struct st_command *command)
sizeof(chmod_file_args)/sizeof(struct command_arg), sizeof(chmod_file_args)/sizeof(struct command_arg),
' '); ' ');
if (bad_path(ds_file.str))
DBUG_VOID_RETURN;
/* Parse what mode to set */ /* Parse what mode to set */
if (ds_mode.length != 4 || if (ds_mode.length != 4 ||
str2int(ds_mode.str, 8, 0, INT_MAX, &mode) == NullS) str2int(ds_mode.str, 8, 0, INT_MAX, &mode) == NullS)
...@@ -3931,6 +3980,9 @@ void do_mkdir(struct st_command *command) ...@@ -3931,6 +3980,9 @@ void do_mkdir(struct st_command *command)
mkdir_args, sizeof(mkdir_args)/sizeof(struct command_arg), mkdir_args, sizeof(mkdir_args)/sizeof(struct command_arg),
' '); ' ');
if (bad_path(ds_dirname.str))
DBUG_VOID_RETURN;
DBUG_PRINT("info", ("creating directory: %s", ds_dirname.str)); DBUG_PRINT("info", ("creating directory: %s", ds_dirname.str));
error= my_mkdir(ds_dirname.str, 0777, MYF(MY_WME)) != 0; error= my_mkdir(ds_dirname.str, 0777, MYF(MY_WME)) != 0;
handle_command_error(command, error, my_errno); handle_command_error(command, error, my_errno);
...@@ -3938,6 +3990,47 @@ void do_mkdir(struct st_command *command) ...@@ -3938,6 +3990,47 @@ void do_mkdir(struct st_command *command)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
/*
Remove directory recursively.
*/
static int rmtree(const char *dir)
{
char path[FN_REFLEN];
char sep[]={ FN_LIBCHAR, 0 };
int err=0;
MY_DIR *dir_info= my_dir(dir, MYF(MY_DONT_SORT | MY_WANT_STAT));
if (!dir_info)
return 1;
for (uint i= 0; i < dir_info->number_of_files; i++)
{
FILEINFO *file= dir_info->dir_entry + i;
/* Skip "." and ".." */
if (!strcmp(file->name, ".") || !strcmp(file->name, ".."))
continue;
strxnmov(path, sizeof(path), dir, sep, file->name, NULL);
if (!MY_S_ISDIR(file->mystat->st_mode))
err= my_delete(path, 0);
else
err= rmtree(path);
if(err)
break;
}
my_dirend(dir_info);
if (!err)
err= rmdir(dir);
return err;
}
/* /*
SYNOPSIS SYNOPSIS
do_rmdir do_rmdir
...@@ -3945,12 +4038,11 @@ void do_mkdir(struct st_command *command) ...@@ -3945,12 +4038,11 @@ void do_mkdir(struct st_command *command)
DESCRIPTION DESCRIPTION
rmdir <dir_name> rmdir <dir_name>
Remove the empty directory <dir_name> Remove the directory tree
*/ */
void do_rmdir(struct st_command *command) void do_rmdir(struct st_command *command)
{ {
int error;
static DYNAMIC_STRING ds_dirname; static DYNAMIC_STRING ds_dirname;
const struct command_arg rmdir_args[] = { const struct command_arg rmdir_args[] = {
{ "dirname", ARG_STRING, TRUE, &ds_dirname, "Directory to remove" } { "dirname", ARG_STRING, TRUE, &ds_dirname, "Directory to remove" }
...@@ -3961,9 +4053,13 @@ void do_rmdir(struct st_command *command) ...@@ -3961,9 +4053,13 @@ void do_rmdir(struct st_command *command)
rmdir_args, sizeof(rmdir_args)/sizeof(struct command_arg), rmdir_args, sizeof(rmdir_args)/sizeof(struct command_arg),
' '); ' ');
if (bad_path(ds_dirname.str))
DBUG_VOID_RETURN;
DBUG_PRINT("info", ("removing directory: %s", ds_dirname.str)); DBUG_PRINT("info", ("removing directory: %s", ds_dirname.str));
error= rmdir(ds_dirname.str) != 0; if (rmtree(ds_dirname.str))
handle_command_error(command, error, errno); handle_command_error(command, 1, errno);
dynstr_free(&ds_dirname); dynstr_free(&ds_dirname);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -4076,6 +4172,9 @@ static void do_list_files_write_file_command(struct st_command *command, ...@@ -4076,6 +4172,9 @@ static void do_list_files_write_file_command(struct st_command *command,
list_files_args, list_files_args,
sizeof(list_files_args)/sizeof(struct command_arg), ' '); sizeof(list_files_args)/sizeof(struct command_arg), ' ');
if (bad_path(ds_filename.str))
DBUG_VOID_RETURN;
init_dynamic_string(&ds_content, "", 1024, 1024); init_dynamic_string(&ds_content, "", 1024, 1024);
error= get_list_files(&ds_content, &ds_dirname, &ds_wild); error= get_list_files(&ds_content, &ds_dirname, &ds_wild);
handle_command_error(command, error, my_errno); handle_command_error(command, error, my_errno);
...@@ -4127,7 +4226,8 @@ void read_until_delimiter(DYNAMIC_STRING *ds, ...@@ -4127,7 +4226,8 @@ void read_until_delimiter(DYNAMIC_STRING *ds,
while (1) while (1)
{ {
c= my_getc(cur_file->file); c= my_getc(cur_file->file);
if (c == '\r')
c= my_getc(cur_file->file);
if (c == '\n') if (c == '\n')
{ {
cur_file->lineno++; cur_file->lineno++;
...@@ -4178,6 +4278,9 @@ void do_write_file_command(struct st_command *command, my_bool append) ...@@ -4178,6 +4278,9 @@ void do_write_file_command(struct st_command *command, my_bool append)
sizeof(write_file_args)/sizeof(struct command_arg), sizeof(write_file_args)/sizeof(struct command_arg),
' '); ' ');
if (bad_path(ds_filename.str))
DBUG_VOID_RETURN;
if (!append && access(ds_filename.str, F_OK) == 0) if (!append && access(ds_filename.str, F_OK) == 0)
{ {
/* The file should not be overwritten */ /* The file should not be overwritten */
...@@ -4559,7 +4662,7 @@ void do_perl(struct st_command *command) ...@@ -4559,7 +4662,7 @@ void do_perl(struct st_command *command)
if (command->abort_on_error) if (command->abort_on_error)
die("popen(\"%s\", \"r\") failed", buf); die("popen(\"%s\", \"r\") failed", buf);
dynstr_free(&ds_delimiter); dynstr_free(&ds_delimiter);
return; DBUG_VOID_RETURN;
} }
while (fgets(buf, sizeof(buf), res_file)) while (fgets(buf, sizeof(buf), res_file))
......
...@@ -83,19 +83,26 @@ IF(FEATURE_SET) ...@@ -83,19 +83,26 @@ IF(FEATURE_SET)
ENDIF() ENDIF()
OPTION(ENABLED_LOCAL_INFILE "" ON) OPTION(ENABLED_LOCAL_INFILE "" ON)
SET(WITH_INNODB_SNAPPY OFF CACHE STRING "")
IF(WIN32) IF(WIN32)
SET(WITH_LIBARCHIVE STATIC CACHE STRING "")
ELSEIF(RPM) ELSEIF(RPM)
SET(WITH_SSL system CACHE STRING "") SET(WITH_SSL system CACHE STRING "")
SET(WITH_ZLIB system CACHE STRING "") SET(WITH_ZLIB system CACHE STRING "")
SET(CHECKMODULE /usr/bin/checkmodule CACHE STRING "")
SET(SEMODULE_PACKAGE /usr/bin/semodule_package CACHE STRING "")
SET(WITH_LIBARCHIVE ON CACHE STRING "")
ELSEIF(DEB) ELSEIF(DEB)
SET(WITH_SSL system CACHE STRING "") SET(WITH_SSL system CACHE STRING "")
SET(WITH_ZLIB system CACHE STRING "") SET(WITH_ZLIB system CACHE STRING "")
SET(WITH_LIBWRAP ON) SET(WITH_LIBWRAP ON)
SET(HAVE_EMBEDDED_PRIVILEGE_CONTROL ON) SET(HAVE_EMBEDDED_PRIVILEGE_CONTROL ON)
SET(WITH_LIBARCHIVE ON CACHE STRING "")
ELSE() ELSE()
SET(WITH_SSL bundled CACHE STRING "") SET(WITH_SSL bundled CACHE STRING "")
SET(WITH_ZLIB bundled CACHE STRING "") SET(WITH_ZLIB bundled CACHE STRING "")
SET(WITH_JEMALLOC static CACHE STRING "") SET(WITH_JEMALLOC static CACHE STRING "")
SET(WITH_LIBARCHIVE STATIC CACHE STRING "")
ENDIF() ENDIF()
IF(NOT COMPILATION_COMMENT) IF(NOT COMPILATION_COMMENT)
......
...@@ -23,10 +23,14 @@ SET(CPACK_COMPONENT_SHAREDLIBRARIES_GROUP "shared") ...@@ -23,10 +23,14 @@ SET(CPACK_COMPONENT_SHAREDLIBRARIES_GROUP "shared")
SET(CPACK_COMPONENT_COMMON_GROUP "common") SET(CPACK_COMPONENT_COMMON_GROUP "common")
SET(CPACK_COMPONENT_CLIENTPLUGINS_GROUP "common") SET(CPACK_COMPONENT_CLIENTPLUGINS_GROUP "common")
SET(CPACK_COMPONENT_COMPAT_GROUP "compat") SET(CPACK_COMPONENT_COMPAT_GROUP "compat")
SET(CPACK_COMPONENT_BACKUP_GROUP "backup")
SET(CPACK_COMPONENTS_ALL Server ManPagesServer IniFiles Server_Scripts SET(CPACK_COMPONENTS_ALL Server ManPagesServer IniFiles Server_Scripts
SupportFiles Development ManPagesDevelopment SupportFiles Development ManPagesDevelopment
ManPagesTest Readme ManPagesClient Test ManPagesTest Readme ManPagesClient Test
Common Client SharedLibraries ClientPlugins) Common Client SharedLibraries ClientPlugins
backup
)
SET(CPACK_RPM_PACKAGE_NAME ${CPACK_PACKAGE_NAME}) SET(CPACK_RPM_PACKAGE_NAME ${CPACK_PACKAGE_NAME})
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${VERSION}-${RPM}-${CMAKE_SYSTEM_PROCESSOR}") SET(CPACK_PACKAGE_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${VERSION}-${RPM}-${CMAKE_SYSTEM_PROCESSOR}")
...@@ -98,6 +102,7 @@ SET(CPACK_RPM_client_USER_FILELIST ${ignored} "%config(noreplace) ${INSTALL_SYSC ...@@ -98,6 +102,7 @@ SET(CPACK_RPM_client_USER_FILELIST ${ignored} "%config(noreplace) ${INSTALL_SYSC
SET(CPACK_RPM_compat_USER_FILELIST ${ignored}) SET(CPACK_RPM_compat_USER_FILELIST ${ignored})
SET(CPACK_RPM_devel_USER_FILELIST ${ignored}) SET(CPACK_RPM_devel_USER_FILELIST ${ignored})
SET(CPACK_RPM_test_USER_FILELIST ${ignored}) SET(CPACK_RPM_test_USER_FILELIST ${ignored})
SET(CPACK_RPM_backup_USER_FILELIST ${ignored})
# "set/append array" - append a set of strings, separated by a space # "set/append array" - append a set of strings, separated by a space
MACRO(SETA var) MACRO(SETA var)
......
...@@ -15,15 +15,29 @@ ...@@ -15,15 +15,29 @@
# Symbols with information about the CPU. # Symbols with information about the CPU.
FIND_PROGRAM(GETCONF getconf) IF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
MARK_AS_ADVANCED(GETCONF) FIND_PROGRAM(SYSCTL sysctl)
MARK_AS_ADVANCED(SYSCTL)
IF(GETCONF) IF(SYSCTL)
EXECUTE_PROCESS( EXECUTE_PROCESS(
COMMAND ${GETCONF} LEVEL1_DCACHE_LINESIZE COMMAND ${SYSCTL} -n hw.cachelinesize
OUTPUT_VARIABLE CPU_LEVEL1_DCACHE_LINESIZE OUTPUT_VARIABLE CPU_LEVEL1_DCACHE_LINESIZE
) )
ENDIF()
ELSE()
FIND_PROGRAM(GETCONF getconf)
MARK_AS_ADVANCED(GETCONF)
IF(GETCONF)
EXECUTE_PROCESS(
COMMAND ${GETCONF} LEVEL1_DCACHE_LINESIZE
OUTPUT_VARIABLE CPU_LEVEL1_DCACHE_LINESIZE
)
ENDIF()
ENDIF() ENDIF()
IF(CPU_LEVEL1_DCACHE_LINESIZE AND CPU_LEVEL1_DCACHE_LINESIZE GREATER 0) IF(CPU_LEVEL1_DCACHE_LINESIZE AND CPU_LEVEL1_DCACHE_LINESIZE GREATER 0)
ELSE() ELSE()
SET(CPU_LEVEL1_DCACHE_LINESIZE 64) SET(CPU_LEVEL1_DCACHE_LINESIZE 64)
......
...@@ -188,7 +188,7 @@ MACRO(MERGE_STATIC_LIBS TARGET OUTPUT_NAME LIBS_TO_MERGE) ...@@ -188,7 +188,7 @@ MACRO(MERGE_STATIC_LIBS TARGET OUTPUT_NAME LIBS_TO_MERGE)
# binaries properly) # binaries properly)
ADD_CUSTOM_COMMAND(TARGET ${TARGET} POST_BUILD ADD_CUSTOM_COMMAND(TARGET ${TARGET} POST_BUILD
COMMAND rm ${TARGET_LOCATION} COMMAND rm ${TARGET_LOCATION}
COMMAND /usr/bin/libtool -static -o ${TARGET_LOCATION} COMMAND libtool -static -o ${TARGET_LOCATION}
${STATIC_LIBS} ${STATIC_LIBS}
) )
ELSE() ELSE()
......
...@@ -38,6 +38,14 @@ FUNCTION (MYSQL_ADD_EXECUTABLE) ...@@ -38,6 +38,14 @@ FUNCTION (MYSQL_ADD_EXECUTABLE)
SET(sources ${ARG_DEFAULT_ARGS}) SET(sources ${ARG_DEFAULT_ARGS})
ADD_VERSION_INFO(${target} EXECUTABLE sources) ADD_VERSION_INFO(${target} EXECUTABLE sources)
IF(MSVC)
# Add compatibility manifest, to fix GetVersionEx on Windows 8.1 and later
IF (CMAKE_VERSION VERSION_GREATER 3.3)
SET(sources ${sources} ${PROJECT_SOURCE_DIR}/cmake/win_compatibility.manifest)
ENDIF()
ENDIF()
ADD_EXECUTABLE(${target} ${ARG_WIN32} ${ARG_MACOSX_BUNDLE} ${ARG_EXCLUDE_FROM_ALL} ${sources}) ADD_EXECUTABLE(${target} ${ARG_WIN32} ${ARG_MACOSX_BUNDLE} ${ARG_EXCLUDE_FROM_ALL} ${sources})
# tell CPack where to install # tell CPack where to install
IF(NOT ARG_EXCLUDE_FROM_ALL) IF(NOT ARG_EXCLUDE_FROM_ALL)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment