| Bug #58087 | mysqltest re-evaluates 'let' expressions infinitely | ||
|---|---|---|---|
| Submitted: | 9 Nov 2010 17:26 | Modified: | 6 Dec 2010 3:41 | 
| Reporter: | Sven Sandberg | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Tools: MTR / mysql-test-run | Severity: | S3 (Non-critical) | 
| Version: | 5.1+ | OS: | Any | 
| Assigned to: | Bjørn Munch | CPU Architecture: | Any | 
| Tags: | mysqltest | ||
   [10 Nov 2010 8:30]
   Valeriy Kravchuk        
  This is what I've got: openxs@ubuntu:/home2/openxs/dbs/5.1/mysql-test$ ./mtr bug58087 Logging: ./mtr bug58087 101110 10:27:20 [Note] Plugin 'FEDERATED' is disabled. MySQL Version 5.1.54 Checking supported features... - skipping ndbcluster - SSL connections supported - binaries are debug compiled Collecting tests... vardir: /home2/openxs/dbs/5.1/mysql-test/var Checking leftover processes... Removing old var directory... Creating var directory '/home2/openxs/dbs/5.1/mysql-test/var'... Installing system database... Using server port 51198 ============================================================================== TEST RESULT TIME (ms) ------------------------------------------------------------ worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 13000..13009 main.bug58087 [ fail ] Test ended at 2010-11-10 10:27:31 CURRENT_TEST: main.bug58087 mysqltest failed but provided no output The result from queries just before the failure was: < snip > CREATE TABLE t1 (a VARCHAR(100)); INSERT INTO t1 VALUES ('`SELECT * FROM t1`'); - saving '/home2/openxs/dbs/5.1/mysql-test/var/log/main.bug58087/' to '/home2/openxs/dbs/5.1/mysql-test/var/log/main.bug58087/' ------------------------------------------------------------ The servers were restarted 0 times Spent 0.000 of 14 seconds executing testcases Completed: Failed 1/1 tests, 0.00% were successful.
   [15 Nov 2010 13:25]
   Bugs System        
  A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/123900 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
   [17 Nov 2010 12:29]
   Bjørn Munch        
  Pushed to -mtr branches
   [23 Nov 2010 20:34]
   Paul DuBois        
  Changes to test suite. No changelog entry needed.
   [5 Dec 2010 12:39]
   Bugs System        
  Pushed into mysql-trunk 5.6.1 (revid:alexander.nozdrin@oracle.com-20101205122447-6x94l4fmslpbttxj) (version source revid:alexander.nozdrin@oracle.com-20101205122447-6x94l4fmslpbttxj) (merge vers: 5.6.1) (pib:23)
   [15 Dec 2010 5:52]
   Bugs System        
  Pushed into mysql-5.1 5.1.55 (revid:sunanda.menon@oracle.com-20101215054055-vgwki317xg1wphhh) (version source revid:sunanda.menon@oracle.com-20101215054055-vgwki317xg1wphhh) (merge vers: 5.1.55) (pib:23)
   [16 Dec 2010 22:28]
   Bugs System        
  Pushed into mysql-5.5 5.5.9 (revid:jonathan.perkin@oracle.com-20101216101358-fyzr1epq95a3yett) (version source revid:jonathan.perkin@oracle.com-20101216101358-fyzr1epq95a3yett) (merge vers: 5.5.9) (pib:24)


Description: mysqltest supports the following syntax: let $x= `SQL STATEMENT`; let $x= $variable; where the right hand side is interpolated by sending the statement to the server in the first case, and replacing $variable by the value of $variable in the second case. A surprising "feature" is that mysqltest re-interpolates the expression as long as possible. This is confusing because most languages interpolate only once. It makes some tasks difficult, such as executing an SQL statement that returns a backtick-quoted string and saving the result in a variable. How to repeat: # This "quine" causes mysqltest to interpolate infinitely # and eventually crash. CREATE TABLE t1 (a VARCHAR(100)); INSERT INTO t1 VALUES ('`SELECT * FROM t1`'); let $a= `SELECT * FROM t1`; Suggested fix: This is used as a feature by some tests, e.g. to simulate data structures like arrays: # initialize 3 elements of "array" a --let $a_1= 47 --let $a_2= 11 --let $a_3= 42 # print all elements of a --let $i= 3 while ($i) { --let $x= \$a_$i --echo $x --dec $i } It would be better if mysqltest provided this feature by other less obscure means.