#At file:///data/msvensson/mysql/5.1-rpl/
2642 Magnus Svensson 2008-08-04
Bug #32307 mysqltest - does not detect illegal if syntax
removed:
mysql-test/r/not_as_root.require
modified:
client/mysqltest.c
mysql-test/extra/rpl_tests/rpl_row_sp002.test
mysql-test/include/not_as_root.inc
mysql-test/mysql-test-run.pl
mysql-test/r/mysqltest.result
mysql-test/t/execution_constants.test
mysql-test/t/mysqltest.test
mysql-test/t/ps.test
=== modified file 'client/mysqltest.c'
--- a/client/mysqltest.c 2008-07-30 10:16:30 +0000
+++ b/client/mysqltest.c 2008-08-04 10:38:50 +0000
@@ -2184,8 +2184,16 @@ void eval_expr(VAR *v, const char *p, co
if (*p == '$')
{
VAR *vp;
+ const char* expected_end= *p_end; // Remember var end
if ((vp= var_get(p, p_end, 0, 0)))
var_copy(v, vp);
+
+ /* Make sure there was just a $variable and nothing else */
+ const char* end= *p_end + 1;
+ if (end < expected_end)
+ die("Found junk '%.*s' after $variable in expression",
+ expected_end - end - 1, end);
+
DBUG_VOID_RETURN;
}
=== modified file 'mysql-test/extra/rpl_tests/rpl_row_sp002.test'
--- a/mysql-test/extra/rpl_tests/rpl_row_sp002.test 2007-03-29 18:31:09 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_row_sp002.test 2008-08-04 10:38:50 +0000
@@ -206,7 +206,7 @@ START TRANSACTION;
-- disable_query_log
-- disable_result_log
let $n=50;
-while ($n>3)
+while ($n)
{
eval call test.p3($n);
dec $n;
=== modified file 'mysql-test/include/not_as_root.inc'
--- a/mysql-test/include/not_as_root.inc 2006-04-24 10:01:16 +0000
+++ b/mysql-test/include/not_as_root.inc 2008-08-04 10:38:50 +0000
@@ -1,4 +1,3 @@
--- require r/not_as_root.require
-disable_query_log;
-eval select "$MYSQL_TEST_ROOT" as running_as_root;
-enable_query_log;
+if ($MYSQL_TEST_ROOT){
+ skip Not as root;
+}
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl 2008-08-01 14:13:35 +0000
+++ b/mysql-test/mysql-test-run.pl 2008-08-04 10:38:50 +0000
@@ -1883,7 +1883,6 @@ sub check_running_as_root () {
# the file will not return 0000
my $file_mode= (stat($test_file))[2] & 07777;
- $ENV{'MYSQL_TEST_ROOT'}= "NO";
mtr_verbose("result: $result, file_mode: $file_mode");
if ($result eq "MySQL" && $file_mode == 0)
{
=== modified file 'mysql-test/r/mysqltest.result'
--- a/mysql-test/r/mysqltest.result 2008-04-29 16:08:52 +0000
+++ b/mysql-test/r/mysqltest.result 2008-08-04 10:38:50 +0000
@@ -293,7 +293,7 @@ var5 from query that returns no row
failing query in let
mysqltest: At line 1: Error running query 'failing query': 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'failing query' at line 1
mysqltest: At line 1: Missing required argument 'filename' to command 'source'
-mysqltest: At line 1: Could not open './non_existingFile' for reading
+mysqltest: At line 1: Could not open './non_existingFile' for reading, errno: 2
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/recursive.sql": At line 1: Source directives are nesting too deep
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/error.sql": At line 1: query 'garbage ' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
@@ -443,7 +443,7 @@ ERROR 3D000: No database selected
Output from mysqltest-x.inc
Output from mysqltest-x.inc
Output from mysqltest-x.inc
-mysqltest: Could not open './non_existing_file.inc' for reading: errno = 2
+mysqltest: Could not open './non_existing_file.inc' for reading, errno: 2
failing_statement;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'failing_statement' at line 1
failing_statement;
@@ -728,4 +728,6 @@ mysqltest: At line 1: change user failed
SELECT 'c:\\a.txt' AS col;
col
z
+hej
+mysqltest: At line 1: Found junk ' != 143' after $variable in expression
End of tests
=== removed file 'mysql-test/r/not_as_root.require'
--- a/mysql-test/r/not_as_root.require 2006-04-24 08:21:09 +0000
+++ b/mysql-test/r/not_as_root.require 1970-01-01 00:00:00 +0000
@@ -1,2 +0,0 @@
-running_as_root
-NO
=== modified file 'mysql-test/t/execution_constants.test'
--- a/mysql-test/t/execution_constants.test 2006-11-13 16:06:45 +0000
+++ b/mysql-test/t/execution_constants.test 2008-08-04 10:38:50 +0000
@@ -41,12 +41,19 @@ while ($i)
error 0,1436 //
eval $query_head 0 $query_tail//
- if ($mysql_errno != 1436)
+ if ($mysql_errno)
{
# We reached the place where we reported an error about the stack limit,
# and we successfully returned the error. That means that at the stack
# limit, we still have enough space reserved to report an error.
let $i = 1//
+
+ # Check that mysql_errno is 1436
+ if (`select $mysql_errno != 1436`)
+ {
+ die Wrong error triggered, expected 1436 but got $mysql_errno//
+ }
+
}
# Multiplying by three stack frames should be fine enough resolution.
=== modified file 'mysql-test/t/mysqltest.test'
--- a/mysql-test/t/mysqltest.test 2008-04-29 16:08:52 +0000
+++ b/mysql-test/t/mysqltest.test 2008-08-04 10:38:50 +0000
@@ -2131,5 +2131,25 @@ rmdir $MYSQLTEST_VARDIR/tmp/testdir;
--replace_result c:\\a.txt z
SELECT 'c:\\a.txt' AS col;
+#
+# Bug #32307 mysqltest - does not detect illegal if syntax
+#
+
+let $test= 1;
+if ($test){
+ echo hej;
+}
+
+--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
+if ($mysql_errno != 1436)
+{
+ echo ^ Should not be allowed!
+}
+EOF
+--error 1
+--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
+remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
+
+
--echo End of tests
=== modified file 'mysql-test/t/ps.test'
--- a/mysql-test/t/ps.test 2008-05-20 18:43:26 +0000
+++ b/mysql-test/t/ps.test 2008-08-04 10:38:50 +0000
@@ -1665,7 +1665,7 @@ DROP PROCEDURE IF EXISTS p1;
let $iterations= 100;
--disable_query_log
--disable_result_log
-while ($iterations > 0)
+while ($iterations)
{
--error ER_PARSE_ERROR
PREPARE stmt FROM "CREATE PROCEDURE p1()";
| Thread |
|---|
| • bzr commit into mysql-5.1 branch (msvensson:2642) Bug#32307 | Magnus Svensson | 4 Aug |