From 8001e398df6724052bf0b1957ff1d9578f6b00a5 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 7 May 2005 08:16:43 -0700 Subject: [PATCH 01/12] Eliminate gcc 4.0 warning in libedit code. (Bug #9603) cmd-line-utils/libedit/vi.c: Eliminate compiler warning --- cmd-line-utils/libedit/vi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd-line-utils/libedit/vi.c b/cmd-line-utils/libedit/vi.c index 4a0352859dd..b977ce716c6 100644 --- a/cmd-line-utils/libedit/vi.c +++ b/cmd-line-utils/libedit/vi.c @@ -1014,7 +1014,7 @@ vi_histedit(EditLine *el, int c) return CC_ERROR; case 0: close(fd); - execlp("vi", "vi", tempfile, 0); + execlp("vi", "vi", tempfile, (char *) NULL); exit(0); /*NOTREACHED*/ default: From a91cf275c872477242d8d036004abd521aaa0978 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 10 May 2005 14:13:58 +0500 Subject: [PATCH 02/12] bug#10344: some string function fail for UCS2 substr fix --- mysql-test/r/ctype_ucs.result | 18 ++++++++++++++++++ mysql-test/t/ctype_ucs.test | 10 ++++++++++ strings/ctype-ucs2.c | 2 +- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index 3face9b1ba6..5902dd247ce 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -598,6 +598,24 @@ ucs2_bin 00610009 ucs2_bin 0061 ucs2_bin 00610020 drop table t1; +select hex(substr(_ucs2 0x00e400e50068,1)); +hex(substr(_ucs2 0x00e400e50068,1)) +00E400E50068 +select hex(substr(_ucs2 0x00e400e50068,2)); +hex(substr(_ucs2 0x00e400e50068,2)) +00E50068 +select hex(substr(_ucs2 0x00e400e50068,3)); +hex(substr(_ucs2 0x00e400e50068,3)) +0068 +select hex(substr(_ucs2 0x00e400e50068,-1)); +hex(substr(_ucs2 0x00e400e50068,-1)) +0068 +select hex(substr(_ucs2 0x00e400e50068,-2)); +hex(substr(_ucs2 0x00e400e50068,-2)) +00E50068 +select hex(substr(_ucs2 0x00e400e50068,-3)); +hex(substr(_ucs2 0x00e400e50068,-3)) +00E400E50068 SET NAMES latin1; SET collation_connection='ucs2_swedish_ci'; CREATE TABLE t1 (Field1 int(10) default '0'); diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index db5b13cf1b4..6c72c409463 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -374,6 +374,16 @@ SET NAMES latin1; SET collation_connection='ucs2_bin'; -- source include/ctype_filesort.inc +# +# Bug#10344 Some string functions fail for UCS2 +# +select hex(substr(_ucs2 0x00e400e50068,1)); +select hex(substr(_ucs2 0x00e400e50068,2)); +select hex(substr(_ucs2 0x00e400e50068,3)); +select hex(substr(_ucs2 0x00e400e50068,-1)); +select hex(substr(_ucs2 0x00e400e50068,-2)); +select hex(substr(_ucs2 0x00e400e50068,-3)); + SET NAMES latin1; # # Bug#8235 diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index f5d0721fa9b..f12cfe3256e 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -1261,7 +1261,7 @@ uint my_charpos_ucs2(CHARSET_INFO *cs __attribute__((unused)), const char *e __attribute__((unused)), uint pos) { - return pos*2; + return pos > e - b ? e - b + 2 : pos * 2; } From 05a945ecf42087ad46bd120624af0c356e4041c8 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 10 May 2005 13:53:47 +0200 Subject: [PATCH 03/12] Makefile.am, configure.in: Enable creation of embedded lib when --with-darwin-mwcc configure.in: Enable creation of embedded lib when --with-darwin-mwcc libmysqld/Makefile.am: Enable creation of embedded lib when --with-darwin-mwcc --- configure.in | 3 +++ libmysqld/Makefile.am | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 00ec737e76f..9d524de125a 100644 --- a/configure.in +++ b/configure.in @@ -145,8 +145,11 @@ AC_ARG_WITH(darwin-mwcc, export CC CXX LD AR RANLIB AC_SUBST(AR) AC_SUBST(RANLIB) + with_darwin_mwcc=yes ]) +AM_CONDITIONAL(DARWIN_MWCC, test x$with_darwin_mwcc = xyes) + if test "x${CFLAGS-}" = x ; then cflags_is_set=no else diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am index 4cf2c3f67a7..f578e87ae4a 100644 --- a/libmysqld/Makefile.am +++ b/libmysqld/Makefile.am @@ -83,6 +83,9 @@ INC_LIB= $(top_builddir)/regex/libregex.a \ # generate a total libmysqld.a from all library files, libmysqld.a: libmysqld_int.a $(INC_LIB) +if DARWIN_MWCC + mwld -lib -o $@ libmysqld_int.a `ls -1 $(INC_LIB) | sort -u` +else if test "$(host_os)" = "netware" ; \ then \ $(libmysqld_a_AR) libmysqld.a libmysqld_int.a $(INC_LIB) ; \ @@ -104,7 +107,7 @@ libmysqld.a: libmysqld_int.a $(INC_LIB) rm -f tmp/* ; \ $(RANLIB) libmysqld.a ; \ fi - +endif ## XXX: any time the client interface changes, we'll need to bump ## the version info for libmysqld; however, it's possible for the From 5afb72220d81eac038c3345b7e7edd9823b973a9 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 10 May 2005 17:00:54 +0500 Subject: [PATCH 04/12] ctype-big5.c: additional fix for bug@10493, for sjis ctype-cp932.c: additional fix for bug#10493, for cp932 strings/ctype-cp932.c: additional fix for bug#10493, for cp932 strings/ctype-big5.c: additional fix for bug@10493, for sjis --- strings/ctype-big5.c | 2 +- strings/ctype-cp932.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c index 07b30205f89..52886116ff2 100644 --- a/strings/ctype-big5.c +++ b/strings/ctype-big5.c @@ -6285,7 +6285,7 @@ uint my_well_formed_len_big5(CHARSET_INFO *cs __attribute__((unused)), const char *emb= e - 1; /* Last possible end of an MB character */ *error= 0; - while (pos && b < e) + while (pos-- && b < e) { if ((uchar) b[0] < 128) { diff --git a/strings/ctype-cp932.c b/strings/ctype-cp932.c index 0db38afa1f7..d9e3bbd5866 100644 --- a/strings/ctype-cp932.c +++ b/strings/ctype-cp932.c @@ -5417,7 +5417,7 @@ uint my_well_formed_len_cp932(CHARSET_INFO *cs __attribute__((unused)), { const char *b0= b; *error= 0; - while (pos && b < e) + while (pos-- && b < e) { /* Cast to int8 for extra safety. From 4c2265b0aeedceb8407f2e06f4d949a711b4f534 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 10 May 2005 17:51:29 +0200 Subject: [PATCH 05/12] Fix for Ingo BUILD/check-cpu: Set old_flag to pentium --- BUILD/check-cpu | 1 + 1 file changed, 1 insertion(+) diff --git a/BUILD/check-cpu b/BUILD/check-cpu index 3cce4b1ab3d..7619224314b 100755 --- a/BUILD/check-cpu +++ b/BUILD/check-cpu @@ -57,6 +57,7 @@ case "$cpu_family--$model_name" in ;; *Pentium*M*pro*) cpu_flag="pentium-m"; + cpu_flag_old="pentium"; ;; *Athlon*64*) cpu_flag="athlon64"; From cbbc4ff6a25accdd3e11a0e2719c2201d23a7b68 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 12 May 2005 17:49:34 +0200 Subject: [PATCH 06/12] If the system is under high load 'show full processlist' might report the process of the predecessing test case instead of the current test case. Shifting the command to the end of the current test case should avoid this problem. mysql-test/r/ps_grant.result: Updated result mysql-test/t/ps_grant.test: Shift ' show full processlist ' to the end of the test script --- mysql-test/r/ps_grant.result | 8 ++++---- mysql-test/t/ps_grant.test | 9 +++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/mysql-test/r/ps_grant.result b/mysql-test/r/ps_grant.result index 4c60bb03165..0787f30c643 100644 --- a/mysql-test/r/ps_grant.result +++ b/mysql-test/r/ps_grant.result @@ -1,7 +1,3 @@ -prepare stmt4 from ' show full processlist '; -execute stmt4; -Id User Host db Command Time State Info -number root localhost test Query time NULL show full processlist test_sequence ------ grant/revoke/drop affects a parallel session test ------ show grants for second_user@localhost ; @@ -79,3 +75,7 @@ commit ; show grants for second_user@localhost ; ERROR 42000: There is no such grant defined for user 'second_user' on host 'localhost' drop database mysqltest; +prepare stmt4 from ' show full processlist '; +execute stmt4; +Id User Host db Command Time State Info +number root localhost test Query time NULL show full processlist diff --git a/mysql-test/t/ps_grant.test b/mysql-test/t/ps_grant.test index 06613072824..d6448dd152a 100644 --- a/mysql-test/t/ps_grant.test +++ b/mysql-test/t/ps_grant.test @@ -1,10 +1,6 @@ # Can't test grants with embedded server -- source include/not_embedded.inc -# Tested here simply so it is not tested with embedded server -prepare stmt4 from ' show full processlist '; ---replace_column 1 number 6 time 3 localhost -execute stmt4; let $type= 'MYISAM' ; @@ -116,4 +112,9 @@ show grants for second_user@localhost ; drop database mysqltest; +# Tested here simply so it is not tested with embedded server +prepare stmt4 from ' show full processlist '; +--replace_column 1 number 6 time 3 localhost +execute stmt4; + From 29f3f4a27fd2afa4a7fc57aaba86bb102e7cebe1 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 13 May 2005 15:06:11 +0200 Subject: [PATCH 07/12] added function mysql_set_character_set (reviewed by Monty) as a work around for #8317 and #9637 This function sends SET NAMES command and changes mysql->charset so mysql_real_escape_string will work as expected. libmysql/libmysql.def: added new function mysql_set_character_set --- libmysql/libmysql.c | 30 ++++++++++++++++++++++++++++++ libmysql/libmysql.def | 1 + 2 files changed, 31 insertions(+) diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index c663dab7476..4c9f06df38e 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -1509,6 +1509,36 @@ const char * STDCALL mysql_character_set_name(MYSQL *mysql) return mysql->charset->csname; } +int STDCALL mysql_set_character_set(MYSQL *mysql, char *cs_name) +{ + struct charset_info_st *cs; + const char *save_csdir = charsets_dir; + + if (mysql->options.charset_dir) + charsets_dir = mysql->options.charset_dir; + + if ( (cs = get_charset_by_csname(cs_name, MY_CS_PRIMARY, MYF(0))) ) + { + char buff[MY_CS_NAME_SIZE + 10]; + charsets_dir = save_csdir; + sprintf(buff, "SET NAMES %s", cs_name); + if (!mysql_query(mysql, buff)) { + mysql->charset = cs; + } + } else { + char cs_dir_name[FN_REFLEN]; + get_charsets_dir(cs_dir_name); + mysql->net.last_errno=CR_CANT_READ_CHARSET; + strmov(mysql->net.sqlstate, unknown_sqlstate); + my_snprintf(mysql->net.last_error, sizeof(mysql->net.last_error)-1, + ER(mysql->net.last_errno), + cs_name, + cs_dir_name); + + } + charsets_dir = save_csdir; + return mysql->net.last_errno; +} uint STDCALL mysql_thread_safe(void) { diff --git a/libmysql/libmysql.def b/libmysql/libmysql.def index c5579e9ec2b..57c97ab08ee 100644 --- a/libmysql/libmysql.def +++ b/libmysql/libmysql.def @@ -146,4 +146,5 @@ EXPORTS mysql_rpl_query_type mysql_slave_query mysql_embedded + mysql_set_character_set get_defaults_files From 92cb62c86fa68bacd5ab58703a704bd4d290ac72 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 13 May 2005 15:54:35 +0200 Subject: [PATCH 08/12] added prototype for mysql_set_character_set function --- include/mysql.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/mysql.h b/include/mysql.h index d8a56126756..ab61fe694d9 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -381,6 +381,7 @@ unsigned int STDCALL mysql_warning_count(MYSQL *mysql); const char * STDCALL mysql_info(MYSQL *mysql); unsigned long STDCALL mysql_thread_id(MYSQL *mysql); const char * STDCALL mysql_character_set_name(MYSQL *mysql); +int STDCALL mysql_set_character_set(MYSQL *mysql, char *csname); MYSQL * STDCALL mysql_init(MYSQL *mysql); my_bool STDCALL mysql_ssl_set(MYSQL *mysql, const char *key, From c4a1210fd4ef4a3bab2f5dddbdc8ededeb33a307 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 13 May 2005 18:37:22 +0300 Subject: [PATCH 09/12] row0mysql.c: InnoDB wrongly complained in the .err log that MySQL is trying to drop a non-existent table, if tablespace ran out (Bug #10607) innobase/row/row0mysql.c: InnoDB wrongly complained in the .err log that MySQL is trying to drop a non-existent table, if tablespace ran out (Bug #10607) --- innobase/row/row0mysql.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c index 9410f2ce7cc..280c306cce4 100644 --- a/innobase/row/row0mysql.c +++ b/innobase/row/row0mysql.c @@ -1606,10 +1606,18 @@ row_create_table_for_mysql( trx_general_rollback_for_mysql(trx, FALSE, NULL); if (err == DB_OUT_OF_FILE_SPACE) { - fputs("InnoDB: Warning: cannot create table ", stderr); + ut_print_timestamp(stderr); + + fputs(" InnoDB: Warning: cannot create table ", + stderr); ut_print_name(stderr, trx, table->name); fputs(" because tablespace full\n", stderr); - row_drop_table_for_mysql(table->name, trx, FALSE); + + if (dict_table_get_low(table->name)) { + + row_drop_table_for_mysql(table->name, trx, + FALSE); + } } else if (err == DB_DUPLICATE_KEY) { ut_print_timestamp(stderr); From c3f73a428193150df234881352875ca3383b9740 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 13 May 2005 21:43:26 +0200 Subject: [PATCH 10/12] sql/ha_blackhole.cc bug#10175 - blackhole.test hangs with "Warning: prev link 1 didn't point at previous lock at read: read lock with no write locks" sql/sql_base.cc libmysqld/examples/mysql.cc linking problem sql/ha_blackhole.cc: bug#10175 - blackhole.test hangs with "Warning: prev link 1 didn't point at previous lock at read: read lock with no write locks" sql/sql_base.cc: libmysqld/examples/mysql.cc linking problem --- sql/ha_blackhole.cc | 3 ++- sql/sql_base.cc | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sql/ha_blackhole.cc b/sql/ha_blackhole.cc index 7c6e7cb56b6..c9c94b3a9d7 100644 --- a/sql/ha_blackhole.cc +++ b/sql/ha_blackhole.cc @@ -129,8 +129,9 @@ THR_LOCK_DATA **ha_blackhole::store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type) { + if (lock_type != TL_IGNORE && lock.type == TL_UNLOCK) + lock.type=lock_type; *to++= &lock; - return to; } diff --git a/sql/sql_base.cc b/sql/sql_base.cc index c580842ce06..e86362c857b 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -2522,7 +2522,7 @@ bool get_key_map_from_key_list(key_map *map, TABLE *table, if ((pos= find_type(&table->keynames, name->ptr(), name->length(), 1)) <= 0) { - my_error(ER_KEY_COLUMN_DOES_NOT_EXITS, MYF(0), name->c_ptr(), + my_error(ER_KEY_COLUMN_DOES_NOT_EXITS, MYF(0), name->c_ptr_safe(), table->real_name); map->set_all(); return 1; From 752372f62626321f60563c6c825424801b5a7f60 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 14 May 2005 02:28:10 +0400 Subject: [PATCH 11/12] Fix wrong format specifier in error messages. Not to be pushed into 5.0 as there it's fixed differently (in the new format of error messages) sql/share/danish/errmsg.txt: Fix wrong format specifier in an error message. sql/share/serbian/errmsg.txt: Fix wrong format specifier in an error message. --- sql/share/danish/errmsg.txt | 2 +- sql/share/serbian/errmsg.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt index 384625f7112..4983d39714a 100644 --- a/sql/share/danish/errmsg.txt +++ b/sql/share/danish/errmsg.txt @@ -262,7 +262,7 @@ character-set=latin1 "Key reference and table reference don't match", "Operand should contain %d column(s)", "Subquery returns more than 1 row", -"Unknown prepared statement handler (%ld) given to %s", +"Unknown prepared statement handler (%.*s) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", "Converting column '%s' from %s to %s", diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt index accf1926abb..adda7d7cf53 100644 --- a/sql/share/serbian/errmsg.txt +++ b/sql/share/serbian/errmsg.txt @@ -252,7 +252,7 @@ character-set=cp1250 "Key reference and table reference don't match", "Operand should contain %d column(s)", "Subquery returns more than 1 row", -"Unknown prepared statement handler (%ld) given to %s", +"Unknown prepared statement handler (%.*s) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", "Converting column '%s' from %s to %s", From ba3540cc6991c49e0f43501e600018896b5e0dcb Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 14 May 2005 02:31:26 +0400 Subject: [PATCH 12/12] Fix a valgrind warning: memcpy does not allow its arguments to overlap. --- libmysql/libmysql.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 4c9f06df38e..3fcdc6bdc4d 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -3944,9 +3944,12 @@ my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind) /* We only need to check that stmt->field_count - if it is not null stmt->bind was initialized in mysql_stmt_prepare - */ + stmt->bind overlaps with bind if mysql_stmt_bind_param + is called from mysql_stmt_store_result. + */ - memcpy((char*) stmt->bind, (char*) bind, sizeof(MYSQL_BIND) * bind_count); + if (stmt->bind != bind) + memcpy((char*) stmt->bind, (char*) bind, sizeof(MYSQL_BIND) * bind_count); for (param= stmt->bind, end= param + bind_count, field= stmt->fields ; param < end ;