From a5a9fcdfe44ffb093887a255254d128fe3752fd1 Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 5 Aug 2022 17:57:27 +0300 Subject: MDEV-12325 Unexpected data type and truncation when using CTE When creating a recursive CTE, the column types are taken from the non recursive part of the CTE (this is according to the SQL standard). This patch adds code to abort the CTE if the calculated values in the recursive part does not fit in the fields in the created temporary table. The new code only affects recursive CTE, so it should not cause any notable problems for old applications. Other things: - Fixed that we get correct row numbers for warnings generated with WITH RECURSIVE Reviewer: Alexander Barkov --- mysql-test/main/cte_recursive.result | 145 +++++++++++++++++++++++++++++++++++ mysql-test/main/cte_recursive.test | 43 +++++++++++ sql/sql_class.h | 4 +- sql/sql_error.h | 10 +++ sql/sql_union.cc | 23 +++++- sql/sql_yacc.yy | 1 - 6 files changed, 223 insertions(+), 3 deletions(-) diff --git a/mysql-test/main/cte_recursive.result b/mysql-test/main/cte_recursive.result index 0c98530c9bf..7bf85016f11 100644 --- a/mysql-test/main/cte_recursive.result +++ b/mysql-test/main/cte_recursive.result @@ -4873,4 +4873,149 @@ a 0 NULL DROP TABLE t1; +# +# MDEV-12325 Unexpected data type and truncation when using CTE +# +CREATE TABLE t1 +( +id INT, mid INT, name TEXT +); +INSERT INTO t1 VALUES (0,NULL,'Name'),(1,0,'Name1'),(2,0,'Name2'),(11,1,'Name11'),(12,1,'Name12'); +WITH RECURSIVE +cteReports (level, id, mid, name) AS +( +SELECT 1, id, mid, name FROM t1 WHERE mid IS NULL +UNION ALL +SELECT r.level + 1, e.id, e.mid + 1000000000000, e.name FROM t1 e +INNER JOIN cteReports r ON e.mid = r.id +) +SELECT +level, id, mid, name, +(SELECT name FROM t1 WHERE id= cteReports.mid) AS mname +FROM cteReports ORDER BY level, mid; +ERROR 22003: Out of range value for column 'mid' at row 2 +create table t2 as WITH RECURSIVE +cteReports (level, id, mid, name) AS +( +SELECT 1, id, mid, name FROM t1 WHERE mid IS NULL +UNION ALL +SELECT r.level + 1, e.id, e.mid + 1000000000000, e.name FROM t1 e +INNER JOIN cteReports r ON e.mid = r.id +) +SELECT +level, id, mid, name, +(SELECT name FROM t1 WHERE id= cteReports.mid) AS mname +FROM cteReports ORDER BY level, mid;; +ERROR 22003: Out of range value for column 'mid' at row 2 +create table t2 ignore as WITH RECURSIVE +cteReports (level, id, mid, name) AS +( +SELECT 1, id, mid, name FROM t1 WHERE mid IS NULL +UNION ALL +SELECT r.level + 1, e.id, e.mid + 1000000000000, e.name FROM t1 e +INNER JOIN cteReports r ON e.mid = r.id +) +SELECT +level, id, mid, name, +(SELECT name FROM t1 WHERE id= cteReports.mid) AS mname +FROM cteReports ORDER BY level, mid;; +Warnings: +Warning 1264 Out of range value for column 'mid' at row 2 +Warning 1264 Out of range value for column 'mid' at row 3 +Warning 1264 Out of range value for column 'mid' at row 4 +Warning 1264 Out of range value for column 'mid' at row 5 +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `level` int(1) DEFAULT NULL, + `id` int(11) DEFAULT NULL, + `mid` int(11) DEFAULT NULL, + `name` text DEFAULT NULL, + `mname` text DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t2 WITH RECURSIVE +cteReports (level, id, mid, name) AS +( +SELECT 1, id, mid, name FROM t1 WHERE mid IS NULL +UNION ALL +SELECT r.level + 1, e.id, e.mid + 1000000000000, e.name FROM t1 e +INNER JOIN cteReports r ON e.mid = r.id +) +SELECT +level, id, mid, name, +(SELECT name FROM t1 WHERE id= cteReports.mid) AS mname +FROM cteReports ORDER BY level, mid;; +ERROR 22003: Out of range value for column 'mid' at row 2 +insert ignore into t2 WITH RECURSIVE +cteReports (level, id, mid, name) AS +( +SELECT 1, id, mid, name FROM t1 WHERE mid IS NULL +UNION ALL +SELECT r.level + 1, e.id, e.mid + 1000000000000, e.name FROM t1 e +INNER JOIN cteReports r ON e.mid = r.id +) +SELECT +level, id, mid, name, +(SELECT name FROM t1 WHERE id= cteReports.mid) AS mname +FROM cteReports ORDER BY level, mid;; +Warnings: +Warning 1264 Out of range value for column 'mid' at row 2 +Warning 1264 Out of range value for column 'mid' at row 3 +Warning 1264 Out of range value for column 'mid' at row 4 +Warning 1264 Out of range value for column 'mid' at row 5 +drop table t2; +set @@sql_mode=""; +WITH RECURSIVE +cteReports (level, id, mid, name) AS +( +SELECT 1, id, mid, name FROM t1 WHERE mid IS NULL +UNION ALL +SELECT r.level + 1, e.id, e.mid + 1000000000000, e.name FROM t1 e +INNER JOIN cteReports r ON e.mid = r.id +) +SELECT +level, id, mid, name, +(SELECT name FROM t1 WHERE id= cteReports.mid) AS mname +FROM cteReports ORDER BY level, mid; +level id mid name mname +1 0 NULL Name NULL +2 1 2147483647 Name1 NULL +2 2 2147483647 Name2 NULL +3 11 2147483647 Name11 NULL +3 12 2147483647 Name12 NULL +Warnings: +Warning 1264 Out of range value for column 'mid' at row 2 +Warning 1264 Out of range value for column 'mid' at row 3 +Warning 1264 Out of range value for column 'mid' at row 4 +Warning 1264 Out of range value for column 'mid' at row 5 +create table t2 as WITH RECURSIVE +cteReports (level, id, mid, name) AS +( +SELECT 1, id, mid, name FROM t1 WHERE mid IS NULL +UNION ALL +SELECT r.level + 1, e.id, e.mid + 1000000000000, e.name FROM t1 e +INNER JOIN cteReports r ON e.mid = r.id +) +SELECT +level, id, mid, name, +(SELECT name FROM t1 WHERE id= cteReports.mid) AS mname +FROM cteReports ORDER BY level, mid;; +Warnings: +Warning 1264 Out of range value for column 'mid' at row 2 +Warning 1264 Out of range value for column 'mid' at row 3 +Warning 1264 Out of range value for column 'mid' at row 4 +Warning 1264 Out of range value for column 'mid' at row 5 +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `level` int(1) DEFAULT NULL, + `id` int(11) DEFAULT NULL, + `mid` int(11) DEFAULT NULL, + `name` text DEFAULT NULL, + `mname` text DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +set @@sql_mode=default; +drop table t1,t2; +# # End of 10.3 tests +# diff --git a/mysql-test/main/cte_recursive.test b/mysql-test/main/cte_recursive.test index 4c4bd99c24c..ca97c2d2900 100644 --- a/mysql-test/main/cte_recursive.test +++ b/mysql-test/main/cte_recursive.test @@ -3165,4 +3165,47 @@ SELECT * FROM cte; DROP TABLE t1; +--echo # +--echo # MDEV-12325 Unexpected data type and truncation when using CTE +--echo # + +CREATE TABLE t1 +( + id INT, mid INT, name TEXT +); +INSERT INTO t1 VALUES (0,NULL,'Name'),(1,0,'Name1'),(2,0,'Name2'),(11,1,'Name11'),(12,1,'Name12'); + +let $query= +WITH RECURSIVE +cteReports (level, id, mid, name) AS +( + SELECT 1, id, mid, name FROM t1 WHERE mid IS NULL + UNION ALL + SELECT r.level + 1, e.id, e.mid + 1000000000000, e.name FROM t1 e + INNER JOIN cteReports r ON e.mid = r.id +) +SELECT + level, id, mid, name, + (SELECT name FROM t1 WHERE id= cteReports.mid) AS mname +FROM cteReports ORDER BY level, mid; + +--error ER_WARN_DATA_OUT_OF_RANGE +--eval $query +--error ER_WARN_DATA_OUT_OF_RANGE +--eval create table t2 as $query; +--eval create table t2 ignore as $query; +show create table t2; +--error ER_WARN_DATA_OUT_OF_RANGE +--eval insert into t2 $query; +--eval insert ignore into t2 $query; +drop table t2; +set @@sql_mode=""; +--eval $query +--eval create table t2 as $query; +show create table t2; +set @@sql_mode=default; +drop table t1,t2; + +--echo # --echo # End of 10.3 tests +--echo # diff --git a/sql/sql_class.h b/sql/sql_class.h index 850a8364adc..05b8f7eb443 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -5691,10 +5691,12 @@ class select_union_recursive :public select_unit or for the unit specifying a CTE that mutually recursive with this CTE. */ uint cleanup_count; + long row_counter; select_union_recursive(THD *thd_arg): select_unit(thd_arg), - incr_table(0), first_rec_table_to_update(0), cleanup_count(0) + incr_table(0), first_rec_table_to_update(0), cleanup_count(0), + row_counter(0) { incr_table_param.init(); }; int send_data(List &items); diff --git a/sql/sql_error.h b/sql/sql_error.h index 3b29f7aba06..ec52724b6da 100644 --- a/sql/sql_error.h +++ b/sql/sql_error.h @@ -722,6 +722,13 @@ private: /** Reset the current row counter. Start counting from the first row. */ void reset_current_row_for_warning() { m_current_row_for_warning= 1; } + ulong set_current_row_for_warning(ulong row) + { + ulong old_row= m_current_row_for_warning; + m_current_row_for_warning= row; + return old_row; + } + /** Return the current counter value. */ ulong current_row_for_warning() const { return m_current_row_for_warning; } @@ -1099,6 +1106,9 @@ public: void opt_clear_warning_info(ulonglong query_id) { get_warning_info()->opt_clear(query_id); } + long set_current_row_for_warning(long row) + { return get_warning_info()->set_current_row_for_warning(row); } + ulong current_row_for_warning() const { return get_warning_info()->current_row_for_warning(); } diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 48d8c16db68..32d307de5e8 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -297,7 +297,27 @@ bool select_unit::send_eof() int select_union_recursive::send_data(List &values) { - int rc= select_unit::send_data(values); + + int rc; + bool save_abort_on_warning= thd->abort_on_warning; + enum_check_fields save_count_cuted_fields= thd->count_cuted_fields; + long save_counter; + + /* + For recursive CTE's give warnings for wrong field info + However, we don't do that for CREATE TABLE ... SELECT or INSERT ... SELECT + as the upper level code for these handles setting of abort_on_warning + depending on if 'IGNORE' is used. + */ + if (thd->lex->sql_command != SQLCOM_CREATE_TABLE && + thd->lex->sql_command != SQLCOM_INSERT_SELECT) + thd->abort_on_warning= thd->is_strict_mode(); + thd->count_cuted_fields= CHECK_FIELD_WARN; + save_counter= thd->get_stmt_da()->set_current_row_for_warning(++row_counter); + rc= select_unit::send_data(values); + thd->get_stmt_da()->set_current_row_for_warning(save_counter); + thd->count_cuted_fields= save_count_cuted_fields; + thd->abort_on_warning= save_abort_on_warning; if (rc == 0 && write_err != HA_ERR_FOUND_DUPP_KEY && @@ -476,6 +496,7 @@ void select_union_recursive::cleanup() thd->rec_tables= tab; tbl->derived_result= 0; } + row_counter= 0; } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 770e5e1c3e7..577405725ca 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -15373,7 +15373,6 @@ with_clause: MYSQL_YYABORT; Lex->derived_tables|= DERIVED_WITH; Lex->with_cte_resolution= true; - Lex->with_cte_resolution= true; Lex->curr_with_clause= with_clause; with_clause->add_to_list(Lex->with_clauses_list_last_next); } -- cgit v1.2.1 From 4a53253cf9aff82ad9066b13702181a34edc2749 Mon Sep 17 00:00:00 2001 From: Monty Date: Sat, 6 Aug 2022 15:06:22 +0300 Subject: Fixed that sp-no-valgrind.test is disabled on valgrind builds (not runs) --- mysql-test/include/not_valgrind_build.inc | 4 ++++ mysql-test/main/sp-no-valgrind.test | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 mysql-test/include/not_valgrind_build.inc diff --git a/mysql-test/include/not_valgrind_build.inc b/mysql-test/include/not_valgrind_build.inc new file mode 100644 index 00000000000..2b60f11bfc7 --- /dev/null +++ b/mysql-test/include/not_valgrind_build.inc @@ -0,0 +1,4 @@ +if (`select version() like '%valgrind%'`) +{ + skip Does not run with binaries built with valgrind; +} diff --git a/mysql-test/main/sp-no-valgrind.test b/mysql-test/main/sp-no-valgrind.test index 89f8250bf72..21e52f2d3d5 100644 --- a/mysql-test/main/sp-no-valgrind.test +++ b/mysql-test/main/sp-no-valgrind.test @@ -1,5 +1,5 @@ ---source include/not_valgrind.inc +--source include/not_valgrind_build.inc --echo # MDEV-20699 do not cache SP in SHOW CREATE --echo # Warmup round, this might allocate some memory for session variable -- cgit v1.2.1 From c0fe31c5dd7ba52098c5f95ccd63ea4bd295fee2 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Mon, 8 Aug 2022 14:00:21 +0200 Subject: fix of MDEV-12325 patch: symetric changes in sql_yacc_ora --- sql/sql_yacc_ora.yy | 1 - 1 file changed, 1 deletion(-) diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy index 23e4a5deb7d..2a42abe5d20 100644 --- a/sql/sql_yacc_ora.yy +++ b/sql/sql_yacc_ora.yy @@ -15351,7 +15351,6 @@ with_clause: MYSQL_YYABORT; Lex->derived_tables|= DERIVED_WITH; Lex->with_cte_resolution= true; - Lex->with_cte_resolution= true; Lex->curr_with_clause= with_clause; with_clause->add_to_list(Lex->with_clauses_list_last_next); } -- cgit v1.2.1 From 195833f1b641b0e119507040ae6feb607201900e Mon Sep 17 00:00:00 2001 From: qggcs Date: Thu, 28 Jul 2022 15:29:53 +0800 Subject: refactor: remove redundant assignments --- sql/item_jsonfunc.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc index 37dd2454116..011cfdc8fd0 100644 --- a/sql/item_jsonfunc.cc +++ b/sql/item_jsonfunc.cc @@ -2605,10 +2605,8 @@ String *Item_func_json_merge_patch::val_str(String *str) if (json_read_value(&je2)) goto error_return; if (je2.value_type == JSON_VALUE_OBJECT) - { - merge_to_null= true; goto cont_point; - } + merge_to_null= false; str->set(js2->ptr(), js2->length(), js2->charset()); goto cont_point; -- cgit v1.2.1 From f2830af16c3a8c551e6b2821e5c7a33e652127b4 Mon Sep 17 00:00:00 2001 From: fluesvamp Date: Sun, 7 Aug 2022 17:07:39 -0500 Subject: Fix typos in the codebase. --- BUILD/SETUP.sh | 2 +- BUILD/compile-irix-mips64-mipspro | 2 +- client/echo.c | 2 +- client/mysql.cc | 2 +- client/mysql_plugin.c | 2 +- client/mysql_upgrade.c | 6 +++--- client/mysqladmin.cc | 2 +- client/mysqlbinlog.cc | 2 +- client/mysqlcheck.c | 2 +- client/mysqldump.c | 16 ++++++++-------- client/mysqlimport.c | 2 +- client/mysqlslap.c | 6 +++--- client/mysqltest.cc | 27 ++++++++++++++------------- cmake/cpack_rpm.cmake | 2 +- cmake/mysql_add_executable.cmake | 2 +- cmake/readline.cmake | 2 +- cmake/sign.cmake.in | 2 +- cmake/zlib.cmake | 2 +- dbug/dbug.c | 2 +- dbug/user.r | 4 ++-- mysql-test/main/mysqltest.result | 2 +- sql/sql_cache.cc | 6 +++--- 22 files changed, 49 insertions(+), 48 deletions(-) diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh index 3d993f63805..ff34bddab37 100755 --- a/BUILD/SETUP.sh +++ b/BUILD/SETUP.sh @@ -121,7 +121,7 @@ get_make_parallel_flag # SSL library to use.--with-ssl will select our bundled yaSSL # implementation of SSL. --with-ssl=yes will first try system library -# then the boundled one --with-ssl=system will use the system library. +# then the bundled one --with-ssl=system will use the system library. # We use bundled by default as this is guaranteed to work with Galera SSL_LIBRARY=--with-ssl diff --git a/BUILD/compile-irix-mips64-mipspro b/BUILD/compile-irix-mips64-mipspro index 917f3d07bbb..94d19358aca 100755 --- a/BUILD/compile-irix-mips64-mipspro +++ b/BUILD/compile-irix-mips64-mipspro @@ -55,7 +55,7 @@ path=`dirname $0` . "$path/autorun.sh" # C options: -# -apo - auto-parallize for multiprocessors (implies -mp) +# -apo - auto-parallelize for multiprocessors (implies -mp) # -mp - generate multiprocessor code # These two common optimization options apparently use 'sproc' model of # threading, which is not compatible with PTHREADS: don't add them unless you diff --git a/client/echo.c b/client/echo.c index 90a538faf62..6904f541960 100644 --- a/client/echo.c +++ b/client/echo.c @@ -16,7 +16,7 @@ /* echo is a replacement for the "echo" command builtin to cmd.exe - on Windows, to get a Unix eqvivalent behaviour when running commands + on Windows, to get a Unix equivalent behaviour when running commands like: $> echo "hello" | mysql diff --git a/client/mysql.cc b/client/mysql.cc index d429a014194..4d14dc0f5f6 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -2334,7 +2334,7 @@ static bool add_line(String &buffer, char *line, size_t line_length, !(*in_string && (mysql.server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES))) { - // Found possbile one character command like \c + // Found possible one character command like \c /* The null-terminating character (ASCII '\0') marks the end of user diff --git a/client/mysql_plugin.c b/client/mysql_plugin.c index bfe394ae758..f496db4e72b 100644 --- a/client/mysql_plugin.c +++ b/client/mysql_plugin.c @@ -281,7 +281,7 @@ static char *convert_path(const char *argument) @param[in] path The Windows path to examine. - @returns string containing excaped quotes if spaces found in path + @returns string containing escaped quotes if spaces found in path */ static char *add_quotes(const char *path) { diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index dde866c6c1d..0c60ce5bd6e 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -701,7 +701,7 @@ static char upgrade_info_file[FN_REFLEN]= {0}; Open or create mysql_upgrade_info file in servers data dir. Take a lock to ensure there cannot be any other mysql_upgrades - runninc concurrently + running concurrently */ const char *create_error_message= @@ -762,7 +762,7 @@ static void open_mysql_upgrade_file() /** Place holder for versions that require a major upgrade - @return 0 upgrade has alredy been run on this version + @return 0 upgrade has already been run on this version @return 1 upgrade has to be run */ @@ -786,7 +786,7 @@ static int faulty_server_versions(const char *version) file it's always better to report that the upgrade hasn't been performed. - @return 0 Upgrade has alredy been run on this version + @return 0 Upgrade has already been run on this version @return > 0 Upgrade has to be run */ diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index a4e06b46d94..a1d16f763f3 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ -/* maintaince of mysql databases */ +/* maintenance of mysql databases */ #include "client_priv.h" #include diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 7df83ae9fd9..1f1bb204493 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -175,7 +175,7 @@ enum Exit_status { /** Pointer to the last read Annotate_rows_log_event. Having read an - Annotate_rows event, we should not print it immediatedly because all + Annotate_rows event, we should not print it immediately because all subsequent rbr events can be filtered away, and have to keep it for a while. Also because of that when reading a remote Annotate event we have to keep its binary log representation in a separately allocated buffer. diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 27ccff2a840..090644e5cb0 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -919,7 +919,7 @@ static int handle_request_for_tables(char *tables, size_t length, case DO_ANALYZE: if (view) { - printf("%-50s %s\n", tables, "Can't run anaylyze on a view"); + printf("%-50s %s\n", tables, "Can't run analyze on a view"); DBUG_RETURN(1); } DBUG_ASSERT(!view); diff --git a/client/mysqldump.c b/client/mysqldump.c index 437677f3638..fba8eec60f3 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -1087,8 +1087,8 @@ static int get_options(int *argc, char ***argv) return(ho_error); /* - Dumping under --system=stats with --replace or --inser-ignore is safe and will not - retult into race condition. Otherwise dump only structure and ignore data by default + Dumping under --system=stats with --replace or --insert-ignore is safe and will not + result into race condition. Otherwise dump only structure and ignore data by default while dumping. */ if (!(opt_system & OPT_SYSTEM_STATS) && !(opt_ignore || opt_replace_into)) @@ -2864,7 +2864,7 @@ static inline my_bool general_log_or_slow_log_tables(const char *db, !my_strcasecmp(charset_info, table, "transaction_registry")); } /* - get_sequence_structure-- retrievs sequence structure, prints out corresponding + get_sequence_structure-- retrieves sequence structure, prints out corresponding CREATE statement ARGS seq - sequence name @@ -2926,7 +2926,7 @@ static void get_sequence_structure(const char *seq, const char *db) DBUG_VOID_RETURN; } /* - get_table_structure -- retrievs database structure, prints out corresponding + get_table_structure -- retrieves database structure, prints out corresponding CREATE statement and fills out insert_pat if the table is the type we will be dumping. @@ -4531,7 +4531,7 @@ static int dump_all_users_roles_and_grants() echo "$dosomethingspecial" ) | mysql -h $host - doesn't end up with a suprise that the $dosomethingspecial cannot + doesn't end up with a surprise that the $dosomethingspecial cannot be done because `special_role` isn't active. We create a new role for importing that becomes the default admin for new @@ -4540,8 +4540,8 @@ static int dump_all_users_roles_and_grants() create new admins for the created role. At the end of the import the mariadb_dump_import_role is be dropped, - which implictly drops all its admin aspects of the dropped role. - This is significiantly easlier than revoking the ADMIN of each role + which implicitly drops all its admin aspects of the dropped role. + This is significantly easier than revoking the ADMIN of each role from the current user. */ fputs("SELECT COALESCE(CURRENT_ROLE(),'NONE') into @current_role;\n" @@ -6960,7 +6960,7 @@ int main(int argc, char **argv) if (opt_system & OPT_SYSTEM_SERVERS) dump_all_servers(); - /* These must be last as they explictly change the current database to mysql */ + /* These must be last as they explicitly change the current database to mysql */ if (opt_system & OPT_SYSTEM_STATS) dump_all_stats(); diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 9d83e65535d..3ec23b874ca 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -579,7 +579,7 @@ static char *add_load_option(char *ptr, const char *object, /* ** Allow the user to specify field terminator strings like: ** "'", "\", "\\" (escaped backslash), "\t" (tab), "\n" (newline) -** This is done by doubleing ' and add a end -\ if needed to avoid +** This is done by doubling ' and add a end -\ if needed to avoid ** syntax errors from the SQL parser. */ diff --git a/client/mysqlslap.c b/client/mysqlslap.c index 0a3a7cd8582..6a41d595bff 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -23,7 +23,7 @@ then reporting the timing of each stage. MySQL slap runs three stages: - 1) Create schema,table, and optionally any SP or data you want to beign + 1) Create schema,table, and optionally any SP or data you want to begin the test with. (single client) 2) Load test (many clients) 3) Cleanup (disconnection, drop table if specified, single client) @@ -2033,7 +2033,7 @@ parse_option(const char *origin, option_string **stmt, char delm) char *buffer_ptr; /* - Return an error if the length of the any of the comma seprated value + Return an error if the length of the comma separated values exceeds HUGE_STRING_LENGTH. */ if ((size_t)(retstr - ptr) > HUGE_STRING_LENGTH) @@ -2079,7 +2079,7 @@ parse_option(const char *origin, option_string **stmt, char delm) char *origin_ptr; /* - Return an error if the length of the any of the comma seprated value + Return an error if the length of any of the comma separated values exceeds HUGE_STRING_LENGTH. */ if (strlen(ptr) > HUGE_STRING_LENGTH) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 855c325c49c..2a6d4265e59 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -563,10 +563,10 @@ char builtin_echo[FN_REFLEN]; struct st_replace_regex { -DYNAMIC_ARRAY regex_arr; /* stores a list of st_regex subsitutions */ +DYNAMIC_ARRAY regex_arr; /* stores a list of st_regex substitutions */ /* -Temporary storage areas for substitutions. To reduce unnessary copying +Temporary storage areas for substitutions. To reduce unnecessary copying and memory freeing/allocation, we pre-allocate two buffers, and alternate their use, one for input/one for output, the roles changing on the next st_regex substitution. At the end of substitutions buf points to the @@ -1932,7 +1932,7 @@ void show_diff(DYNAMIC_STRING* ds, needs special processing due to return values on that OS This test is only done on Windows since it's only needed there - in order to correctly detect non-availibility of 'diff', and + in order to correctly detect non-availability of 'diff', and the way it's implemented does not work with default 'diff' on Solaris. */ #ifdef _WIN32 @@ -2311,7 +2311,7 @@ static int strip_surrounding(char* str, char c1, char c2) /* Replace it with a space */ *ptr= ' '; - /* Last non space charecter should be c2 */ + /* Last non space character should be c2 */ ptr= strend(str)-1; while(*ptr && my_isspace(charset_info, *ptr)) ptr--; @@ -3080,7 +3080,7 @@ void open_file(const char *name) if overlay-dir is specified, and the file is located somewhere under overlay-dir or under suite-dir, the search works as follows: - 0.let suffix be current file dirname relative to siute-dir or overlay-dir + 0.let suffix be current file dirname relative to suite-dir or overlay-dir 1.try in overlay-dir/suffix 2.try in suite-dir/suffix 3.try in overlay-dir @@ -5593,7 +5593,7 @@ void do_close_connection(struct st_command *command) con->stmt= 0; #ifdef EMBEDDED_LIBRARY /* - As query could be still executed in a separate theread + As query could be still executed in a separate thread we need to check if the query's thread was finished and probably wait (embedded-server specific) */ @@ -5888,7 +5888,7 @@ void do_connect(struct st_command *command) { "connection name", ARG_STRING, TRUE, &ds_connection_name, "Name of the connection" }, { "host", ARG_STRING, TRUE, &ds_host, "Host to connect to" }, { "user", ARG_STRING, FALSE, &ds_user, "User to connect as" }, - { "passsword", ARG_STRING, FALSE, &ds_password, "Password used when connecting" }, + { "password", ARG_STRING, FALSE, &ds_password, "Password used when connecting" }, { "database", ARG_STRING, FALSE, &ds_database, "Database to select after connect" }, { "port", ARG_STRING, FALSE, &ds_port, "Port to connect to" }, { "socket", ARG_STRING, FALSE, &ds_sock, "Socket to connect with" }, @@ -6392,7 +6392,7 @@ void do_block(enum block_cmd cmd, struct st_command* command) } else { if (*expr_start != '`' && ! my_isdigit(charset_info, *expr_start)) - die("Expression in if/while must beging with $, ` or a number"); + die("Expression in if/while must begin with $, ` or a number"); eval_expr(&v, expr_start, &expr_end); } @@ -8236,7 +8236,7 @@ void handle_no_error(struct st_command *command) /* Run query using prepared statement C API - SYNPOSIS + SYNOPSIS run_query_stmt mysql - mysql handle command - current command pointer @@ -8471,6 +8471,7 @@ end: } } + DBUG_VOID_RETURN; } @@ -8517,7 +8518,7 @@ int util_query(MYSQL* org_mysql, const char* query){ /* Run query - SYNPOSIS + SYNOPSIS run_query() mysql mysql handle command current command pointer @@ -10244,7 +10245,7 @@ err: /* Execute all substitutions on val. - Returns: true if substituition was made, false otherwise + Returns: true if substitution was made, false otherwise Side-effect: Sets r->buf to be the buffer with all substitutions done. IN: @@ -10338,7 +10339,7 @@ void free_replace_regex() /* - auxiluary macro used by reg_replace + auxiliary macro used by reg_replace makes sure the result buffer has sufficient length */ #define SECURE_REG_BUF if (buf_len < need_buf_len) \ @@ -10877,7 +10878,7 @@ int init_sets(REP_SETS *sets,uint states) return 0; } -/* Make help sets invisible for nicer codeing */ +/* Make help sets invisible for nicer coding */ void make_sets_invisible(REP_SETS *sets) { diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake index eb4f34eb65e..80b11185f9b 100644 --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -326,7 +326,7 @@ IF(compat53 AND compat101) # RHEL6/CentOS6 install Postfix by default, and it requires # libmysqlclient.so.16 that pulls in mysql-libs-5.1.x # And the latter conflicts with our rpms. - # Make sure that for these distribuions all our rpms require + # Make sure that for these distributions all our rpms require # MariaDB-compat, that will replace mysql-libs-5.1 IF(RPM MATCHES "(rhel|centos)[67]") SET(CPACK_RPM_common_PACKAGE_REQUIRES "MariaDB-compat") diff --git a/cmake/mysql_add_executable.cmake b/cmake/mysql_add_executable.cmake index d3a888f9a75..6650b088281 100644 --- a/cmake/mysql_add_executable.cmake +++ b/cmake/mysql_add_executable.cmake @@ -22,7 +22,7 @@ # - instruct CPack to install executable under ${CMAKE_INSTALL_PREFIX}/bin directory # On Windows : # - add version resource -# - instruct CPack to do autenticode signing if SIGNCODE is set +# - instruct CPack to do authenticode signing if SIGNCODE is set INCLUDE(CMakeParseArguments) diff --git a/cmake/readline.cmake b/cmake/readline.cmake index c423a8a830f..916504f96ac 100644 --- a/cmake/readline.cmake +++ b/cmake/readline.cmake @@ -59,7 +59,7 @@ MACRO (FIND_CURSES) remove CMakeCache.txt and rerun cmake.") IF(CMAKE_SYSTEM_NAME MATCHES "Linux") SET(ERRORMSG ${ERRORMSG} - "On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates " + "On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivatives " "it is ncurses-devel.") ENDIF() MESSAGE(FATAL_ERROR ${ERRORMSG}) diff --git a/cmake/sign.cmake.in b/cmake/sign.cmake.in index 50768a3dcc9..6b0fa8b128f 100644 --- a/cmake/sign.cmake.in +++ b/cmake/sign.cmake.in @@ -1,6 +1,6 @@ # If timestamping is used, it can (rarely) fail, when public timestamping service has issues. # -# To handle the error gracefully and tranparently, we'll retry the signtool command, +# To handle the error gracefully and transparently, we'll retry the signtool command, # second time without "/t URL" parameter SET(SIGNTOOL_PARAMETERS_NO_TIMESTAMP "@SIGNTOOL_PARAMETERS@") LIST(FIND SIGNTOOL_PARAMETERS_NO_TIMESTAMP /t idx) diff --git a/cmake/zlib.cmake b/cmake/zlib.cmake index 628bbf15f67..9e085189e4f 100644 --- a/cmake/zlib.cmake +++ b/cmake/zlib.cmake @@ -26,7 +26,7 @@ ENDMACRO() # # Provides the following configure options: # WITH_ZLIB_BUNDLED -# If this is set,we use bindled zlib +# If this is set,we use bundled zlib # If this is not set,search for system zlib. # if system zlib is not found, use bundled copy # ZLIB_LIBRARIES, ZLIB_INCLUDE_DIR and ZLIB_SOURCES diff --git a/dbug/dbug.c b/dbug/dbug.c index 169dd226419..17567585bfd 100644 --- a/dbug/dbug.c +++ b/dbug/dbug.c @@ -55,7 +55,7 @@ * * Michael Widenius: * DBUG_DUMP - To dump a block of memory. - * PUSH_FLAG "O" - To be used insted of "o" if we + * PUSH_FLAG "O" - To be used instead of "o" if we * want flushing after each write * PUSH_FLAG "A" - as 'O', but we will append to the out file instead * of creating a new one. diff --git a/dbug/user.r b/dbug/user.r index 8d8a9ce6910..9a48ba3bcb2 100644 --- a/dbug/user.r +++ b/dbug/user.r @@ -847,7 +847,7 @@ EX:\fC Unlocks DBUG_FILE stream, that was locked with a DBUG_LOCK_FILE. .LI DBUG_ASSERT\ This macro just does a regular assert(). The difference is that it will be -disabled by DBUG_OFF togeher with the +disabled by DBUG_OFF together with the .I dbug library. So there will be no need to disable asserts separately with NDEBUG. .SP 1 @@ -1115,7 +1115,7 @@ will usually have problems using the standard package. The most common problem is multiply allocated memory. .SP 2 -.\" .DE nroff dident like this. davida 900108 +.\" .DE nroff didn't like this. davida 900108 .CS .\" vim:filetype=nroff diff --git a/mysql-test/main/mysqltest.result b/mysql-test/main/mysqltest.result index fe269152357..d4309ffe97e 100644 --- a/mysql-test/main/mysqltest.result +++ b/mysql-test/main/mysqltest.result @@ -500,7 +500,7 @@ anything goes 0 != string mysqltest: At line 2: Only == and != are supported for string values mysqltest: At line 2: Found junk '~= 6' after $variable in condition -mysqltest: At line 2: Expression in if/while must beging with $, ` or a number +mysqltest: At line 2: Expression in if/while must begin with $, ` or a number mysqltest: At line 1: Missing right operand in comparison mysqltest: At line 1: Missing right operand in comparison counter is 2 diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 497e51dfdce..6a23534b99c 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -1206,7 +1206,7 @@ void Query_cache::end_of_result(THD *thd) BLOCK_LOCK_WR(query_block); Query_cache_query *header= query_block->query(); Query_cache_block *last_result_block; - size_t allign_size; + size_t align_size; size_t len; if (header->result() == 0) @@ -1224,8 +1224,8 @@ void Query_cache::end_of_result(THD *thd) DBUG_VOID_RETURN; } last_result_block= header->result()->prev; - allign_size= ALIGN_SIZE(last_result_block->used); - len= MY_MAX(query_cache.min_allocation_unit, allign_size); + align_size= ALIGN_SIZE(last_result_block->used); + len= MY_MAX(query_cache.min_allocation_unit, align_size); if (last_result_block->length >= query_cache.min_allocation_unit + len) query_cache.split_block(last_result_block,len); -- cgit v1.2.1 From 50a2a8bb43b3248763f19cc4624ad37cff068f1d Mon Sep 17 00:00:00 2001 From: fluesvamp <105884371+fluesvamp@users.noreply.github.com> Date: Tue, 2 Aug 2022 18:29:58 -0500 Subject: Update docs INSTALL BINARY to mention mariadb tar file instead --- Docs/INSTALL-BINARY | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Docs/INSTALL-BINARY b/Docs/INSTALL-BINARY index 7ff33c7051e..e2689723656 100644 --- a/Docs/INSTALL-BINARY +++ b/Docs/INSTALL-BINARY @@ -41,8 +41,8 @@ also applies. shell> groupadd mysql shell> useradd -g mysql mysql shell> cd /usr/local -shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf - -shell> ln -s full-path-to-mysql-VERSION-OS mysql +shell> gunzip < /path/to/mariadb-VERSION-OS.tar.gz | tar xvf - +shell> ln -s full-path-to-mariadb-VERSION-OS mysql shell> cd mysql shell> chown -R mysql . shell> chgrp -R mysql . @@ -86,16 +86,16 @@ shell> cd /usr/local 4. Unpack the distribution, which creates the installation directory. Then create a symbolic link to that directory: -shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf - -shell> ln -s full-path-to-mysql-VERSION-OS mysql - The tar command creates a directory named mysql-VERSION-OS. +shell> gunzip < /path/to/mariadb-VERSION-OS.tar.gz | tar xvf - +shell> ln -s full-path-to-mariadb-VERSION-OS mysql + The tar command creates a directory named mariadb-VERSION-OS. The ln command makes a symbolic link to that directory. This lets you refer more easily to the installation directory as /usr/local/mysql. With GNU tar, no separate invocation of gunzip is necessary. You can replace the first line with the following alternative command to uncompress and extract the distribution: -shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz +shell> tar zxvf /path/to/mariadb-VERSION-OS.tar.gz 5. Change location into the installation directory: shell> cd mysql -- cgit v1.2.1 From 9d4ed44cac1c3a0bed1cda68a6113d1be92b97fe Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 4 Aug 2022 21:24:26 +0200 Subject: remove invalid options from warning messages --log-slow-queries was removed in 10.0. Now opt_slow_logname can be set either with --slow-query-log-file or with --log-basename --log was removed in 10.0. Now opt_logname can be set either with --general-log-file or with --log-basename --- sql/mysqld.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 522dcf06ac2..6e68876537f 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4748,15 +4748,15 @@ static int init_common_variables() /* check log options and issue warnings if needed */ if (opt_log && opt_logname && *opt_logname && !(log_output_options & (LOG_FILE | LOG_NONE))) - sql_print_warning("Although a path was specified for the " - "--log option, log tables are used. " + sql_print_warning("Although a general log file was specified, " + "log tables are used. " "To enable logging to files use the --log-output option."); if (global_system_variables.sql_log_slow && opt_slow_logname && *opt_slow_logname && !(log_output_options & (LOG_FILE | LOG_NONE))) - sql_print_warning("Although a path was specified for the " - "--log-slow-queries option, log tables are used. " + sql_print_warning("Although a slow query log file was specified, " + "log tables are used. " "To enable logging to files use the --log-output=file option."); if (!opt_logname || !*opt_logname) -- cgit v1.2.1 From 47d0df6ef02fa1acd5581d1322475a08be3066f5 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 5 Aug 2022 21:47:02 +0200 Subject: take into account C/C specific CR_ERR_NET_WRITE error --- mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold.test b/mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold.test index 4563e9b4469..6f67d7292dc 100644 --- a/mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold.test +++ b/mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold.test @@ -82,7 +82,7 @@ let $counter= 80; let $mysql_errno= 0; while (!$mysql_errno) { - --error 0,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,2002,2006,2013 + --error 0,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,2002,2006,2013,5014 show status; dec $counter; -- cgit v1.2.1 From 82c07fcabf039b2dc8f4b148e46bdb9662f3c0b1 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 9 Aug 2022 14:24:53 +0200 Subject: MDEV-23149 Server crashes in my_convert / ErrConvString::ptr / Item_char_typecast::check_truncation_with_warn --- mysql-test/main/func_compress.result | 11 ++++++++--- mysql-test/main/func_compress.test | 9 +++++---- mysql-test/main/func_json.result | 4 ++-- mysql-test/main/func_json.test | 2 +- sql/item_strfunc.cc | 1 + 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/mysql-test/main/func_compress.result b/mysql-test/main/func_compress.result index 065b68b4979..dde7080fb2a 100644 --- a/mysql-test/main/func_compress.result +++ b/mysql-test/main/func_compress.result @@ -193,9 +193,6 @@ DROP TABLE t1; # End of 10.1 tests # # -# Start of 10.2 tests -# -# # MDEV-10134 Add full support for DEFAULT # CREATE TABLE t1 (a TEXT, b BLOB DEFAULT COMPRESS(a), bl INT DEFAULT UNCOMPRESSED_LENGTH(b), a1 TEXT DEFAULT UNCOMPRESS(b)); @@ -213,5 +210,13 @@ bl a1 100 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa DROP TABLE t1; # +# MDEV-23149 Server crashes in my_convert / ErrConvString::ptr / Item_char_typecast::check_truncation_with_warn +# +select 'foo' in (cast(compress('bar') as char(4)), 'qux'); +'foo' in (cast(compress('bar') as char(4)), 'qux') +0 +Warnings: +Warning 1292 Truncated incorrect CHAR(4) value: '\x03\x00\x00\x00x\x9CKJ,\x02\x00\x02]\x016' +# # End of 10.2 tests # diff --git a/mysql-test/main/func_compress.test b/mysql-test/main/func_compress.test index 983b792f4c4..2a6c0276705 100644 --- a/mysql-test/main/func_compress.test +++ b/mysql-test/main/func_compress.test @@ -173,10 +173,6 @@ DROP TABLE t1; --echo # End of 10.1 tests --echo # ---echo # ---echo # Start of 10.2 tests ---echo # - --echo # --echo # MDEV-10134 Add full support for DEFAULT --echo # @@ -186,6 +182,11 @@ INSERT INTO t1 (a) VALUES (REPEAT('a',100)); SELECT bl, a1 FROM t1; DROP TABLE t1; +--echo # +--echo # MDEV-23149 Server crashes in my_convert / ErrConvString::ptr / Item_char_typecast::check_truncation_with_warn +--echo # +select 'foo' in (cast(compress('bar') as char(4)), 'qux'); + --echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result index 8e3b47e322a..48ce7ed1b3f 100644 --- a/mysql-test/main/func_json.result +++ b/mysql-test/main/func_json.result @@ -765,8 +765,8 @@ DROP TABLE t1; # # MDEV-16054 simple json functions flatline cpu on garbage input. # -select json_array(1,uuid(),compress(5.140264e+307)); -json_array(1,uuid(),compress(5.140264e+307)) +select json_array(1,user(),compress(5.140264e+307)); +json_array(1,user(),compress(5.140264e+307)) NULL # # MDEV-16869 String functions don't respect character set of JSON_VALUE. diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test index 16f323a9a56..9a063adc2cb 100644 --- a/mysql-test/main/func_json.test +++ b/mysql-test/main/func_json.test @@ -429,7 +429,7 @@ DROP TABLE t1; --echo # MDEV-16054 simple json functions flatline cpu on garbage input. --echo # -select json_array(1,uuid(),compress(5.140264e+307)); +select json_array(1,user(),compress(5.140264e+307)); --echo # --echo # MDEV-16869 String functions don't respect character set of JSON_VALUE. diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 75abd9906cd..e9263fb6954 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -4279,6 +4279,7 @@ String *Item_func_compress::val_str(String *str) } str->length((uint32)new_size + 4); + str->set_charset(&my_charset_bin); return str; } -- cgit v1.2.1 From 9ecdf860ce12255bd79869a4f3ac9f6784fe74cf Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 10 Aug 2022 08:59:28 +0200 Subject: missing ' --- mysql-test/mysql-test-run.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 6882ad3e7e4..60955ac61a7 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -4709,7 +4709,7 @@ sub check_warnings ($) { $tinfo->{comment}.= "Could not execute 'check-warnings' for ". "testcase '$tname' (res: $res) server: '". - $mysqld->name() .":\n"; + $mysqld->name() ."':\n"; $tinfo->{comment}.= $report; $result= 2; -- cgit v1.2.1 From 122742897b47a19c85b1a5e9932ab3a8c2a4134e Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 23 Jun 2022 12:59:31 +0200 Subject: my_safe_process: try to kill the process softly first first SIGTERM and if the process didn't die in 10 seconds, SIGKILL it. This allows various tools like `rr`, `gcov`, `gprof`, etc to flush their data to disk properly --- mysql-test/lib/My/SafeProcess/safe_process.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/mysql-test/lib/My/SafeProcess/safe_process.cc b/mysql-test/lib/My/SafeProcess/safe_process.cc index 4d0d1e2a3a0..dcf9491d2d6 100644 --- a/mysql-test/lib/My/SafeProcess/safe_process.cc +++ b/mysql-test/lib/My/SafeProcess/safe_process.cc @@ -140,13 +140,20 @@ void handle_core(pid_t pid __attribute__((unused))) {} static int kill_child(bool was_killed) { int status= 0; + pid_t ret_pid= 0; message("Killing child: %d", child_pid); // Terminate whole process group if (! was_killed) - kill(-child_pid, SIGKILL); + { + kill(-child_pid, SIGTERM); + sleep(10); // will be interrupted by SIGCHLD + if (!(ret_pid= waitpid(child_pid, &status, WNOHANG))) + kill(-child_pid, SIGKILL); + } - pid_t ret_pid= waitpid(child_pid, &status, 0); + if (!ret_pid) + ret_pid= waitpid(child_pid, &status, 0); if (ret_pid == child_pid) { int exit_code= 1; -- cgit v1.2.1 From faddcf3c395da640b760c3f701f5bc1f3baae6c4 Mon Sep 17 00:00:00 2001 From: Nayuta Yanagisawa Date: Wed, 10 Aug 2022 10:40:37 +0200 Subject: Do not check symbol returned (or not and so there is some garbadge) by mb_wc() if mb_wc() failed --- sql/strfunc.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/strfunc.cc b/sql/strfunc.cc index 99ff9c50588..a0a465bdf94 100644 --- a/sql/strfunc.cc +++ b/sql/strfunc.cc @@ -70,7 +70,7 @@ ulonglong find_set(TYPELIB *lib, const char *str, size_t length, CHARSET_INFO *c if ((mblen= cs->cset->mb_wc(cs, &wc, (const uchar *) pos, (const uchar *) end)) < 1) mblen= 1; // Not to hang on a wrong multibyte sequence - if (wc == (my_wc_t) field_separator) + else if (wc == (my_wc_t) field_separator) break; } } -- cgit v1.2.1