From afbab154f156e91e7df06f94aecd3ffb4157420c Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 23 Jul 2026 17:10:11 +0200 Subject: [PATCH] post-merge fixes * restore result=NULL after free in mysqlshow.c (to prevent double-free) * remove DBUG_EVALUATE_IF again * remove useless 'stop slave' from a test * restore charset encoding in mysqltest.{test,result} * correct error for unparseable BINLOG data is ER_SYNTAX_ERROR now * restore old libfmt on rhel-7, gcc 4.8.5 cannot compile anything newer --- client/mysqlshow.c | 3 ++- cmake/libfmt.cmake | 13 ++++++++-- include/my_dbug.h | 3 --- mysql-test/main/grant5.result | 1 - mysql-test/main/grant5.test | 2 +- mysql-test/main/mysqldump-nl.result | 3 --- mysql-test/main/mysqldump-nl.test | 1 - mysql-test/main/mysqltest.result | 9 +++---- mysql-test/main/mysqltest.test | 10 ++++---- mysql-test/main/upgrade.test | 2 +- mysql-test/suite/galera/r/mdev-31651.result | 2 +- mysql-test/suite/galera/t/mdev-31651.test | 2 +- sql/log_event_server.cc | 28 ++++++++++----------- 13 files changed, 40 insertions(+), 39 deletions(-) diff --git a/client/mysqlshow.c b/client/mysqlshow.c index b4ea6878311..76c439ddc75 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -769,9 +769,10 @@ list_fields(MYSQL *mysql,const char *db,const char *table, while ((row=mysql_fetch_row(result))) print_res_row(result,row); print_res_top(result); - mysql_free_result(result); if (opt_show_keys) { + mysql_free_result(result); /* free the columns result set */ + result= NULL; my_snprintf(query, sizeof(query), "show keys from %`s", table); if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql))) { diff --git a/cmake/libfmt.cmake b/cmake/libfmt.cmake index 534ffd22b12..42aee687a2c 100644 --- a/cmake/libfmt.cmake +++ b/cmake/libfmt.cmake @@ -12,11 +12,20 @@ MACRO(BUNDLE_LIBFMT) SET(fmt_byproducts BUILD_BYPRODUCTS ${LIBFMT_INCLUDE_DIR}/fmt/format-inl.h) ENDIF() + IF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9") + # it's for RHEL-7, gcc 4.8.5 + # with newer fmt it complains about missing space in operator""_a() + SET(source URL "https://github.com/fmtlib/fmt/releases/download/11.0.2/fmt-11.0.2.zip" + URL_MD5 c622dca45ec3fc95254c48370a9f7a1d) + ELSE() + SET(source URL "https://github.com/fmtlib/fmt/releases/download/12.2.0/fmt-12.2.0.zip" + URL_MD5 6083253772ad29e73a4d5920be08918e) + ENDIF() + ExternalProject_Add( libfmt PREFIX "${dir}" - URL "https://github.com/fmtlib/fmt/releases/download/12.2.0/fmt-12.2.0.zip" - URL_MD5 6083253772ad29e73a4d5920be08918e + ${source} INSTALL_COMMAND "" CONFIGURE_COMMAND "" BUILD_COMMAND "" diff --git a/include/my_dbug.h b/include/my_dbug.h index e317093fdfb..8e4140e5750 100644 --- a/include/my_dbug.h +++ b/include/my_dbug.h @@ -108,8 +108,6 @@ extern int (*dbug_sanity)(void); do {if (_db_keyword_(0, (keyword), 1)) { a1 }} while(0) #define DBUG_IF(keyword) _db_keyword_(0, (keyword), 1) -#define DBUG_EVALUATE_IF(keyword, a1, a2) \ - (DBUG_IF(keyword) ? (a1) : (a2)) #define DBUG_PUSH_EMPTY if (_dbug_on_) { DBUG_PUSH(""); } #define DBUG_POP_EMPTY if (_dbug_on_) { DBUG_POP(); } @@ -177,7 +175,6 @@ extern void _db_suicide_(void); #define DBUG_EXECUTE(keyword,a1) do { } while(0) #define DBUG_EXECUTE_IF(keyword,a1) do { } while(0) #define DBUG_IF(keyword) 0 -#define DBUG_EVALUATE_IF(keyword, a1, a2) (a2) #define DBUG_PRINT(keyword,arglist) do { } while(0) #define DBUG_PUSH_EMPTY do { } while(0) #define DBUG_POP_EMPTY do { } while(0) diff --git a/mysql-test/main/grant5.result b/mysql-test/main/grant5.result index 033146a385b..58ebb5935fe 100644 --- a/mysql-test/main/grant5.result +++ b/mysql-test/main/grant5.result @@ -472,7 +472,6 @@ DROP USER foo@localhost; CREATE USER foo@localhost IDENTIFIED VIA not_installed_plugin; ERROR HY000: Plugin 'not_installed_plugin' is not loaded # End of 10.5 tests -# # MDEV-40470 GRANT PROXY with empty password incorrectly checks grantor's privileges # create user u1@localhost; diff --git a/mysql-test/main/grant5.test b/mysql-test/main/grant5.test index c5182e1a220..79e463abfa0 100644 --- a/mysql-test/main/grant5.test +++ b/mysql-test/main/grant5.test @@ -436,7 +436,7 @@ DROP USER foo@localhost; CREATE USER foo@localhost IDENTIFIED VIA not_installed_plugin; --echo # End of 10.5 tests ---echo # + --echo # MDEV-40470 GRANT PROXY with empty password incorrectly checks grantor's privileges --echo # create user u1@localhost; diff --git a/mysql-test/main/mysqldump-nl.result b/mysql-test/main/mysqldump-nl.result index 63ef276f172..406613b6d34 100644 --- a/mysql-test/main/mysqldump-nl.result +++ b/mysql-test/main/mysqldump-nl.result @@ -213,9 +213,6 @@ CHANGE MASTER '' TO MASTER_HOST='master''host', MASTER_PORT=3306, MASTER_LOG_FIL -- SET GLOBAL gtid_slave_pos=''; call mtr.add_suppression('Slave I/O: Fatal error: .* Connection attempt terminated'); -stop slave; -Warnings: -Note 1255 Slave already has been stopped reset slave; Warnings: Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos' diff --git a/mysql-test/main/mysqldump-nl.test b/mysql-test/main/mysqldump-nl.test index 20d0246ab05..ce83d5c62bc 100644 --- a/mysql-test/main/mysqldump-nl.test +++ b/mysql-test/main/mysqldump-nl.test @@ -79,7 +79,6 @@ exec $MYSQL_DUMP --compact --dump-slave --include-master-host-port test; # cleanup after mariadb-dump executed START SLAVE call mtr.add_suppression('Slave I/O: Fatal error: .* Connection attempt terminated'); -stop slave; reset slave; change master to master_host='127.0.0.1', master_user='root'; diff --git a/mysql-test/main/mysqltest.result b/mysql-test/main/mysqltest.result index 98b08bc443c..af12773b193 100644 --- a/mysql-test/main/mysqltest.result +++ b/mysql-test/main/mysqltest.result @@ -881,9 +881,9 @@ INSERT INTO t1 SELECT f1 - 256 FROM t1; INSERT INTO t1 SELECT f1 - 512 FROM t1; SELECT * FROM t1; DROP TABLE t1; -select "500g bl�b�rsyltet�y" as "will be lower cased"; +select "500g blåbærsyltetøy" as "will be lower cased"; will be lower cased -500g bl�b�rsyltet�y +500g blåbærsyltetøy SELECT "UPPER" AS "WILL NOT BE lower cased"; WILL NOT BE lower cased UPPER @@ -901,8 +901,8 @@ xyz select 1 as "some new text"; some new text 1 -select 0 as "will not lower case ���"; -will not lower case ��� +select 0 as "will not lower case ÄËÐ"; +will not lower case ÄËÐ 0 CREATE TABLE t1( a int, b varchar(255), c datetime @@ -1033,7 +1033,6 @@ SELECT 1 /* doesn't throw error */; SELECT 1 /* doesn't throw error */; 1 1 -End of tests # # MDEV-38696: infinite loop in my_copy() function # diff --git a/mysql-test/main/mysqltest.test b/mysql-test/main/mysqltest.test index 0139809164a..f4061c09045 100644 --- a/mysql-test/main/mysqltest.test +++ b/mysql-test/main/mysqltest.test @@ -2661,7 +2661,7 @@ DROP TABLE t1; # 1. Basic test --lowercase_result -SELECT "500g BL�B�RSYLTET�Y" AS "WILL BE lower cased"; +SELECT "500g BLÅBÆRSYLTETØY" AS "WILL BE lower cased"; # 2. test that it does not apply to next statement SELECT "UPPER" AS "WILL NOT BE lower cased"; @@ -2689,7 +2689,7 @@ SELECT 1 as "SOME OLD TEXT"; # 7. Test missing lower casing of "unknown" characters --character_set utf8 --lowercase_result -SELECT 0 as "WILL NOT lower case ���"; +SELECT 0 as "WILL NOT lower case ÄËÐ"; --character_set latin1 # ---------------------------------------------------------------------------- @@ -3061,7 +3061,6 @@ EOF --echo # SELECT 1 /* doesn't throw error */; SELECT 1 /* doesn't throw error */; ---echo End of tests --echo # --echo # MDEV-38696: infinite loop in my_copy() function @@ -3078,11 +3077,12 @@ SELECT 1 /* doesn't throw error */; --rmdir $srcdir ---echo # End of 10.11 tests - # Wait till we reached the initial number of concurrent sessions --source include/wait_until_count_sessions.inc --disable_query_log --eval SET GLOBAL max_connections = $saved_max_connections --enable_query_log + +--echo # End of 10.11 tests + diff --git a/mysql-test/main/upgrade.test b/mysql-test/main/upgrade.test index d8ffb1650f0..4b861457d02 100644 --- a/mysql-test/main/upgrade.test +++ b/mysql-test/main/upgrade.test @@ -275,7 +275,7 @@ select * from t1; show create table t1; #--error ER_PARSE_ERROR # no error in 10.11 # uncomment when MDEV-40413 is pushed #alter table t1 convert partition `#mysql50#p-2` to table t2; ---error ER_NO_SUCH_TABLE # no error in 10.11 +--error ER_NO_SUCH_TABLE # remove after MDEV-40413 alter table t1 convert table t2 to partition p2 values in (7); alter table t1 reorganize partition `#mysql50#p-2` into (partition t2 values in (7)); show create table t1; diff --git a/mysql-test/suite/galera/r/mdev-31651.result b/mysql-test/suite/galera/r/mdev-31651.result index 00d4b4860ec..0e573db9dfa 100644 --- a/mysql-test/suite/galera/r/mdev-31651.result +++ b/mysql-test/suite/galera/r/mdev-31651.result @@ -5,7 +5,7 @@ call mtr.add_suppression("BINLOG_BASE64_EVENT: Could not execute Write_rows_v1 e CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b INT, KEY(b)) engine=innodb; BINLOG 'AMqaOw8BAAAAdAAAAHgAAAAAAAQANS42LjM0LTc5LjEtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAAXAAEGggAAAAICAgCAAAACgoKGRkAAYVx w2w='; BINLOG 'wlZOTxMBAAAAKgAAADwCAAAAACkAAAAAAAEABHRlc3QAAnQxAAIDAwAC wlZOTxcBAAAAJgAAAGICAAAAACkAAAAAAAEAAv/8AgAAAAgAAAA='; -Got one of the listed errors +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use SELECT * FROM t1; a b DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/mdev-31651.test b/mysql-test/suite/galera/t/mdev-31651.test index f5e6d819947..5220648f25d 100644 --- a/mysql-test/suite/galera/t/mdev-31651.test +++ b/mysql-test/suite/galera/t/mdev-31651.test @@ -4,7 +4,7 @@ call mtr.add_suppression("BINLOG_BASE64_EVENT: Could not read field"); call mtr.add_suppression("BINLOG_BASE64_EVENT: Could not execute Write_rows_v1 event on table"); CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b INT, KEY(b)) engine=innodb; BINLOG 'AMqaOw8BAAAAdAAAAHgAAAAAAAQANS42LjM0LTc5LjEtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAAXAAEGggAAAAICAgCAAAACgoKGRkAAYVx w2w='; ---error ER_GET_ERRNO,ER_SYNTAX_ERROR +--error ER_SYNTAX_ERROR # corrupted event BINLOG 'wlZOTxMBAAAAKgAAADwCAAAAACkAAAAAAAEABHRlc3QAAnQxAAIDAwAC wlZOTxcBAAAAJgAAAGICAAAAACkAAAAAAAEAAv/8AgAAAAgAAAA='; SELECT * FROM t1; DROP TABLE t1; diff --git a/sql/log_event_server.cc b/sql/log_event_server.cc index d4473c5c555..e886534031f 100644 --- a/sql/log_event_server.cc +++ b/sql/log_event_server.cc @@ -7345,8 +7345,8 @@ bool Table_map_log_event::init_charset_field( if (include_type(binlog_type_info_array, m_table->field[i])) store_compressed_length( buf, - DBUG_EVALUATE_IF("corrupt_table_map_column_charset_length", - (1 << 10), binlog_type_info_array[i].m_cs->number)); + DBUG_IF("corrupt_table_map_column_charset_length") + ? (1 << 10) : binlog_type_info_array[i].m_cs->number); } return write_tlv_field(m_metadata_buf, column_charset_type, buf); } @@ -7378,8 +7378,8 @@ bool Table_map_log_event::init_charset_field( { store_compressed_length( buf, - DBUG_EVALUATE_IF("corrupt_table_map_default_charset_length", - (1 << 10), char_column_index)); + DBUG_IF("corrupt_table_map_default_charset_length") + ? (1 << 10) : char_column_index); store_compressed_length(buf, cs->number); } char_column_index++; @@ -7399,8 +7399,8 @@ bool Table_map_log_event::init_column_name_field() store_compressed_length( buf, - DBUG_EVALUATE_IF("corrupt_table_map_column_name_length", - (1 << 10), len)); + DBUG_IF("corrupt_table_map_column_name_length") + ? (1 << 10) : len); buf.append(m_table->field[i]->field_name.str, len); } return write_tlv_field(m_metadata_buf, COLUMN_NAME, buf); @@ -7425,8 +7425,8 @@ bool Table_map_log_event::init_set_str_value_field() { store_compressed_length( buf, - DBUG_EVALUATE_IF("corrupt_table_map_set_str_value_length", - (1 << 10), typelib->count)); + DBUG_IF("corrupt_table_map_set_str_value_length") + ? (1 << 10) : typelib->count); for (unsigned int i= 0; i < typelib->count; i++) { store_compressed_length(buf, typelib->type_lengths[i]); @@ -7477,8 +7477,8 @@ bool Table_map_log_event::init_geometry_type_field() DBUG_EXECUTE_IF("inject_invalid_geometry_type", geom_type= 100;); store_compressed_length( buf, - DBUG_EVALUATE_IF("corrupt_table_map_geometry_type_length", - (1 << 10), geom_type)); + DBUG_IF("corrupt_table_map_geometry_type_length") + ? (1 << 10) : geom_type); } } @@ -7521,8 +7521,8 @@ bool Table_map_log_event::init_primary_key_field() KEY_PART_INFO *key_part= pk->key_part+i; store_compressed_length( buf, - DBUG_EVALUATE_IF("corrupt_table_map_simple_pk_length", - (1 << 10), key_part->fieldnr-1)); + DBUG_IF("corrupt_table_map_simple_pk_length") + ? (1 << 10) : key_part->fieldnr-1); } return write_tlv_field(m_metadata_buf, SIMPLE_PRIMARY_KEY, buf); } @@ -7536,8 +7536,8 @@ bool Table_map_log_event::init_primary_key_field() store_compressed_length( buf, - DBUG_EVALUATE_IF("corrupt_table_map_pk_prefix_length", - (1 << 10), key_part->fieldnr-1)); + DBUG_IF("corrupt_table_map_pk_prefix_length") + ? (1 << 10) : key_part->fieldnr-1); // Store character length but not octet length if (key_part->length != m_table->field[key_part->fieldnr-1]->key_length())