Bug #56547 Bug#20432 is back: mysql client interprets commands in comments
Submitted: 3 Sep 2010 17:29 Modified: 3 Oct 2010 1:35
Reporter: Joerg Bruehe Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Packaging Severity:S2 (Serious)
Version:5.5.6-m3 OS:Windows
Assigned to: Joerg Bruehe CPU Architecture:Any
Tags: regression

[3 Sep 2010 17:29] Joerg Bruehe
Description:
This was detected in the build of 5.5.6-m3 on Windows, both 32 and 64 bit:

=====
main.mysql                               [ retry-fail ]
        Test ended at YYYY-MM-DD HH:MM:SS

CURRENT_TEST: main.mysql
mysqltest: At line 107: command "$MYSQL              < $file 2>&1" failed

Output from before failure:
ERROR 1064 (42000) at line 1: 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 '"/*"         
"use"
"*/"' at line 1
exec of '/PATH/bin/mysql.exe --defaults-file=G:/pb2/test/sb_1-2225532-1283422154.29/mysql-5.5.6-m3-winx64/mysql-test/var/my.cnf              < /PATH/mysql-test/var/tmp/bug20432.sql 2>&1' failed, error: 1, status: 1, errno: 0

...
=====

Here is the relevant part of the test file:
=====
 97 #
 98 # Bug #20432: mysql client interprets commands in comments
 99 #
100
101 --let $file = $MYSQLTEST_VARDIR/tmp/bug20432.sql
102
103 # if the client sees the 'use' within the comment, we haven't fixed
104 --exec echo "/*"          >  $file
105 --exec echo "use"         >> $file
106 --exec echo "*/"          >> $file
107 --exec $MYSQL              < $file 2>&1
108
=====

How to repeat:
Run the tests on Windows.

Suggested fix:
Revert the change that introduced this regression.
[3 Sep 2010 18:44] Vladislav Vaintroub
Judging by the error message the problem is that all 
"/*", "use", and "*/" are quoted.

For me, it sounds more like strange "echo", perhaps something in mysql-test-run.pl.
[3 Sep 2010 19:06] Vladislav Vaintroub
Assumptions aside, the exact error message quoted in bug description is

ERROR 1064 (42000) at line 1: 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 '"/*"         
"use"
"*/"' at line 1

so it might be good idea  to check the file mysql client executes to see if quoting here is done correctly.
[5 Sep 2010 13:29] Alexey Botchkov
The reason of that behaviour is the unusual behaviour of the 'echo' command on Windows. It writes strings along with the quotes into file. So that the generated file looks like:
"/*"
"use"
"*/"

And the 'mysql' client fails on that quoted file in all the versions i've tested. So that's not the 'client' error. Purely mtr issue - we have to remove these quotes for Windows somehow.
[6 Sep 2010 8:39] Bjørn Munch
Please check which "echo" client is being used. We have a special client, source code in client/echo.c which is there to ensure consistent behavior by stripping off the "" in the argument. Apparently this either isn't built on Windows or the setup causes the Windows default echo to be used instead.

Note that this is the external echo program (since it's called using exec), not to be confused with the mysqltest built-in command echo which does not strip quotes.
[6 Sep 2010 10:48] Joerg Bruehe
In my analysis, I was misled by this test failing (on Windows only) with two different symptoms, that's why I claimed this bug here to have originated on August 20 first.

Sorry, my fault, I should have checked the log: the August 20 failure was a different one.
My sincere apologies!

So this is claimed to be caused by our own "echo" missing in the packages, even though it is still being built.
I suspect it is caused my "client/CMakelists.txt" using the wrong macro when building it ("ADD_EXECUTABLE" vs "MYSQL_ADD_EXECUTABLE") but still need to verify that.
[6 Sep 2010 11:02] Joerg Bruehe
According to several comments, the above suspicion holds:
We need to install our own "echo" as it is used by several tests,
so it must be built using "MYSQL_ADD_EXECUTABLE()".

I'll do that change now.
[6 Sep 2010 11:06] 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/117594

3089 Joerg Bruehe	2010-09-06
      Fix bug#56547
      Bug#20432 is back: mysql client interprets commands in comments
      
      The problem was not caused by a change in the client,
      rather by the tests using the Windows built-in "echo"
      and not the one built bby MySQL.
      This again happened because the binary was missing in the package,
      caused by the wrong macro being used to build it in "cmake".
[6 Sep 2010 11:24] Bjørn Munch
Looks OK to me, if echo.exe gets included it ought to solve the problem.
[6 Sep 2010 11:28] 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/117595

3089 Joerg Bruehe	2010-09-06
      Fix bug#56547  mysql client interprets commands in comments
      
      The problem was not caused by a change in the client,
      rather by the tests using the Windows built-in "echo"
      and not the one built by MySQL.
      This again happened because the binary was missing in the package,
      caused by the wrong macro being used to build it in "cmake".
[6 Sep 2010 11:36] Joerg Bruehe
Patch will be used in the build of 5.5.6,
was approved via IRC.

For documentation:
According to comments above, 5.5.5-m3 also suffers from this bug,
so users running the test suite on Windows with 5.5.5 may encounter it.
[9 Sep 2010 13:51] MC Brown
Pre-release change; no changelog entry required.
[10 Sep 2010 18:51] Bugs System
Pushed into mysql-5.5 5.5.7-rc (revid:joerg@mysql.com-20100910184813-csdto6tk4nlogrsq) (version source revid:joerg@mysql.com-20100910184813-csdto6tk4nlogrsq) (merge vers: 5.5.7-rc) (pib:21)
[13 Sep 2010 13:49] Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:dlenev@mysql.com-20100913103627-p2oqplu42x1gv2bd) (version source revid:dlenev@mysql.com-20100913102657-ye9uwx05td7h2q3o) (merge vers: 5.6.1-m4) (pib:21)
[13 Sep 2010 13:51] Bugs System
Pushed into mysql-next-mr (revid:dlenev@mysql.com-20100913121556-sfxqlpj9kbc28kaf) (version source revid:dlenev@mysql.com-20100913121556-sfxqlpj9kbc28kaf) (pib:21)