List:Commits« Previous MessageNext Message »
From:Bjorn Munch Date:November 15 2010 1:24pm
Subject:bzr commit into mysql-5.1-mtr branch (bjorn.munch:2950) Bug#58087
View as plain text  
#At file:///home/bm136801/my/rekeval-51/ based on revid:bjorn.munch@stripped

 2950 Bjorn Munch	2010-11-15
      Bug #58087 mysqltest re-evaluates 'let' expressions infinitely
      Results from query is sent for evaluation
      Break recursion by asking for ` to be ignored

    modified:
      client/mysqltest.cc
      mysql-test/r/mysqltest.result
      mysql-test/t/mysqltest.test
=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc	2010-11-14 11:23:51 +0000
+++ b/client/mysqltest.cc	2010-11-15 13:23:02 +0000
@@ -471,7 +471,7 @@ VAR* var_init(VAR* v, const char *name,
 void var_free(void* v);
 VAR* var_get(const char *var_name, const char** var_name_end,
              my_bool raw, my_bool ignore_not_existing);
-void eval_expr(VAR* v, const char *p, const char** p_end);
+void eval_expr(VAR* v, const char *p, const char** p_end, bool backtick= true);
 my_bool match_delimiter(int c, const char *delim, uint length);
 void dump_result_to_reject_file(char *buf, int size);
 void dump_warning_messages();
@@ -2233,7 +2233,8 @@ void var_query_set(VAR *var, const char
       dynstr_append_mem(&result, "\t", 1);
     }
     end= result.str + result.length-1;
-    eval_expr(var, result.str, (const char**) &end);
+    /* Evaluation should not recurse via backtick */
+    eval_expr(var, result.str, (const char**) &end, false);
     dynstr_free(&result);
   }
   else
@@ -2389,7 +2390,7 @@ void var_copy(VAR *dest, VAR *src)
 }
 
 
-void eval_expr(VAR *v, const char *p, const char **p_end)
+void eval_expr(VAR *v, const char *p, const char **p_end, bool backtick)
 {
 
   DBUG_ENTER("eval_expr");
@@ -2414,7 +2415,7 @@ void eval_expr(VAR *v, const char *p, co
     DBUG_VOID_RETURN;
   }
 
-  if (*p == '`')
+  if (*p == '`' && backtick)
   {
     var_query_set(v, p, p_end);
     DBUG_VOID_RETURN;

=== modified file 'mysql-test/r/mysqltest.result'
--- a/mysql-test/r/mysqltest.result	2010-09-22 08:57:10 +0000
+++ b/mysql-test/r/mysqltest.result	2010-11-15 13:23:02 +0000
@@ -308,6 +308,10 @@ var3 two columns with same name
 var4 from query that returns NULL
 var5 from query that returns no row
 failing query in let
+create table t1 (a varchar(100));
+insert into t1 values ('`select 42`');
+`select 42`
+drop table t1;
 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, errno: 2

=== modified file 'mysql-test/t/mysqltest.test'
--- a/mysql-test/t/mysqltest.test	2010-10-19 11:56:30 +0000
+++ b/mysql-test/t/mysqltest.test	2010-11-15 13:23:02 +0000
@@ -854,6 +854,13 @@ let $var2= `failing query`;
 echo $var2;
 EOF
 
+create table t1 (a varchar(100));
+insert into t1 values ('`select 42`');
+let $a= `select * from t1`;
+# This should output `select 42`, not evaluate it again to 42
+echo $a;
+drop table t1;
+
 --error 1
 --exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/let.sql 2>&1
 


Attachment: [text/bzr-bundle] bzr/bjorn.munch@oracle.com-20101115132302-sy0fncw2tslxns4y.bundle
Thread
bzr commit into mysql-5.1-mtr branch (bjorn.munch:2950) Bug#58087Bjorn Munch15 Nov