#At file:///home/acorreia/workspace.sun/repository.mysql/bzrwork/bug-36391/mysql-5.1-bugteam/ based on revid:satya.bn@stripped
2752 Alfranio Correia 2009-01-23
BUG#36391: "mysqlbinlog creates invalid charset statements"
The fix for BUG#20103 "Escaping with backslash does not work as expected"
was implemented too greedy though in that it not only changes the behavior
of backslashes within strings but in general, so disabling command shortcuts
like \G or \C
(which in turn leads to Bug #36391: "mysqlbinlog creates invalid charset statements").
The fix allows the escaping with backslash to take place only inside a string,
thus enabling the execution of command shortcuts and presevering the fix for BUG#20103.
added:
mysql-test/suite/bugs/r/rpl_bug36391.result
mysql-test/suite/bugs/t/rpl_bug36391-master.opt
mysql-test/suite/bugs/t/rpl_bug36391.test
modified:
client/mysql.cc
=== modified file 'client/mysql.cc'
--- a/client/mysql.cc 2009-01-05 16:10:20 +0000
+++ b/client/mysql.cc 2009-01-23 11:17:42 +0000
@@ -2044,7 +2044,8 @@ static bool add_line(String &buffer,char
}
#endif
if (!*ml_comment && inchar == '\\' &&
- !(mysql.server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES))
+ !(*in_string &&
+ (mysql.server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES)))
{
// Found possbile one character command like \c
=== added file 'mysql-test/suite/bugs/r/rpl_bug36391.result'
--- a/mysql-test/suite/bugs/r/rpl_bug36391.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/bugs/r/rpl_bug36391.result 2009-01-23 11:17:42 +0000
@@ -0,0 +1,17 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop table if exists t1;
+Warnings:
+Note 1051 Unknown table 't1'
+create table t1(id int);
+show tables;
+Tables_in_test
+t1
+show master status;
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000001 278
+flush logs;
=== added file 'mysql-test/suite/bugs/t/rpl_bug36391-master.opt'
--- a/mysql-test/suite/bugs/t/rpl_bug36391-master.opt 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/bugs/t/rpl_bug36391-master.opt 2009-01-23 11:17:42 +0000
@@ -0,0 +1 @@
+--sql_mode=NO_BACKSLASH_ESCAPES
=== added file 'mysql-test/suite/bugs/t/rpl_bug36391.test'
--- a/mysql-test/suite/bugs/t/rpl_bug36391.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/bugs/t/rpl_bug36391.test 2009-01-23 11:17:42 +0000
@@ -0,0 +1,28 @@
+#
+# BUG#36391 and BUG#38731
+#
+# The fix for BUG#20103 "Escaping with backslash does not work as expected"
+# was implemented too greedy though in that it not only changes the behavior
+# of backslashes within strings but in general, so disabling command shortcuts
+# like \G or \C (which in turn leads to BUG#36391: "mysqlbinlog creates invalid charset statements".)
+#
+# The test executes simple commands that are stored in the binary log and
+# re-execute them through the mysql client which should have to process
+# some command shortcuts. The backslashes within strings is disabled in the file
+# rpl_bug36391-master.opt by the option --sql_mode=NO_BACKSLASH_ESCAPES.
+#
+#
+
+--source include/master-slave.inc
+
+drop table if exists t1;
+
+create table t1(id int);
+
+show tables;
+
+show master status;
+
+flush logs;
+
+--exec $MYSQL_BINLOG $MYSQL_TEST_DIR/var/log/master-bin.000001 | $MYSQL test
| Thread |
|---|
| • bzr commit into mysql-5.1-bugteam branch (alfranio.correia:2752)Bug#36391 | Alfranio Correia | 23 Jan |