summaryrefslogtreecommitdiff
path: root/mysql-test/include
diff options
context:
space:
mode:
authorNuno Carvalho <nuno.carvalho@oracle.com>2012-01-19 16:56:43 +0000
committerNuno Carvalho <nuno.carvalho@oracle.com>2012-01-19 16:56:43 +0000
commit37fce0ece437daf6035e6f6ecd6ec6342b0d224a (patch)
treedaa67a852e8fbcee19ebf6cad41af4facda78828 /mysql-test/include
parentefddb7acb937380acfe667b460555687df728878 (diff)
downloadmariadb-git-37fce0ece437daf6035e6f6ecd6ec6342b0d224a.tar.gz
BUG#13050593 - BACKSLASH SWALLOWED BY INCLUDE/SHOW_SLAVE_STATUS.INC
If an error message contains '\' backslash it is displayed correctly through show-slave-status or query_get_value(SHOW SLAVE STATUS, Last_IO_Error, 1);. But when SELECT REPLACE(...) is applied backslash is escaped resulting in a different test output. Disabled backslash escape on show_slave_status.inc and replaced '\' for '/' using replace_regex function in order to achieve the same test output when different path separators are used.
Diffstat (limited to 'mysql-test/include')
-rw-r--r--mysql-test/include/show_slave_status.inc28
-rw-r--r--mysql-test/include/wait_for_slave_io_error.inc1
2 files changed, 27 insertions, 2 deletions
diff --git a/mysql-test/include/show_slave_status.inc b/mysql-test/include/show_slave_status.inc
index e2fdc72b18b..52ec550ce60 100644
--- a/mysql-test/include/show_slave_status.inc
+++ b/mysql-test/include/show_slave_status.inc
@@ -56,10 +56,17 @@
#
# --let $status_items= Master_Log_File, Relay_Master_Log_File
#
-# $slave_io_error_replace
+# $slave_field_result_replace
# If set, one or more regex patterns for replacing variable
# text in the error message. Syntax as --replace-regex
#
+# $slave_sql_mode
+# If set, change the slave sql mode during this macro, reverting
+# to the previous on exit. Default sql_mode is NO_BACKSLASH_ESCAPES
+# to allow replace '\' by '/' making paths OS independent. Example:
+#
+# --let $slave_sql_mode= NO_BACKSLASH_ESCAPES
+#
--let $_show_slave_status_items=$status_items
@@ -69,13 +76,30 @@ if (!$status_items)
}
+--let $_slave_sql_mode= NO_BACKSLASH_ESCAPES
+if ($slave_sql_mode)
+{
+ --let $_slave_sql_mode= $slave_sql_mode
+}
+--let $_previous_slave_sql_mode = `SELECT @@sql_mode`
+--disable_query_log
+eval SET sql_mode= '$_slave_sql_mode';
+--enable_query_log
+
+
while ($_show_slave_status_items)
{
--let $_show_slave_status_name= `SELECT SUBSTRING_INDEX('$_show_slave_status_items', ',', 1)`
--let $_show_slave_status_items= `SELECT LTRIM(SUBSTRING('$_show_slave_status_items', LENGTH('$_show_slave_status_name') + 2))`
--let $_show_slave_status_value= query_get_value(SHOW SLAVE STATUS, $_show_slave_status_name, 1)
- --replace_regex $slave_io_error_replace
+ --let $_slave_field_result_replace= /[\\]/\// $slave_field_result_replace
+ --replace_regex $_slave_field_result_replace
--let $_show_slave_status_value= `SELECT REPLACE("$_show_slave_status_value", '$MYSQL_TEST_DIR', 'MYSQL_TEST_DIR')`
--echo $_show_slave_status_name = '$_show_slave_status_value'
}
+
+
+--disable_query_log
+eval SET sql_mode= '$_previous_slave_sql_mode';
+--enable_query_log
diff --git a/mysql-test/include/wait_for_slave_io_error.inc b/mysql-test/include/wait_for_slave_io_error.inc
index bc78c9e2da1..4177bf4b858 100644
--- a/mysql-test/include/wait_for_slave_io_error.inc
+++ b/mysql-test/include/wait_for_slave_io_error.inc
@@ -76,6 +76,7 @@ if ($show_slave_io_error)
{
--let $_wait_for_slave_io_error_old_status_items= $status_items
--let $status_items= Last_IO_Error
+ --let $slave_field_result_replace= $slave_io_error_replace
--source include/show_slave_status.inc
--let $status_items= $_wait_for_slave_io_error_old_status_items
}