Bug #58695 mysqltest coredumps on "if($x == ){"
Submitted: 3 Dec 2010 13:34 Modified: 20 Dec 2010 3:10
Reporter: Sven Sandberg Email Updates:
Status: Closed Impact on me:
None 
Category:Tools: MTR / mysql-test-run Severity:S7 (Test Cases)
Version:5.5 OS:Any
Assigned to: Bjørn Munch CPU Architecture:Any
Tags: crash, mysqltest, regression

[3 Dec 2010 13:34] Sven Sandberg
Description:
If a line like the following exists in a test case:

if($x == ){

then mysqltest coredumps:

Program terminated with signal 11, Segmentation fault.
#0  0x00007f91ce03ecfc in pthread_kill () from /lib/libpthread.so.0
#0  0x00007f91ce03ecfc in pthread_kill () from /lib/libpthread.so.0
#1  0x0000000000459fbe in my_write_core (sig=11) at /home/sven/bzr/b49978-cleanup_rpl_tests/trunk-bugfixing/mysys/stacktrace.c:423
#2  0x00000000004195cd in signal_handler (sig=11) at /home/sven/bzr/b49978-cleanup_rpl_tests/trunk-bugfixing/client/mysqltest.cc:8145
#3  <signal handler called>
#4  0x00007f91cd6a6d53 in memcpy () from /lib/libc.so.6
#5  0x000000000040e0ba in eval_expr (v=0x7fff94d64e40, p=0x1dfa11a ") {", p_end=0x7fff94d64ed0, open_end=false, backtick=true) at /home/sven/bzr/b49978-cleanup_rpl_tests/trunk-bugfixing/client/mysqltest.cc:2619
#6  0x0000000000414519 in do_block (cmd=cmd_if, command=0x1df9e30) at /home/sven/bzr/b49978-cleanup_rpl_tests/trunk-bugfixing/client/mysqltest.cc:5705
#7  0x000000000041ac31 in main (argc=11, argv=0x7fff94d65298) at /home/sven/bzr/b49978-cleanup_rpl_tests/trunk-bugfixing/client/mysqltest.cc:8798

How to repeat:
Create a test case with one line:

if($x == ){
[3 Dec 2010 14:11] Valeriy Kravchuk
This does not happen with 5.1.54, so it is a regression of a kind :)
[3 Dec 2010 15:55] Valeriy Kravchuk
What exact version, 5.5.x, and tree do you use? This is what I get:

macbook-pro:mysql-test openxs$ ./mtr bug58695
Logging: ./mtr  bug58695
101203 17:54:12 [Warning] Setting lower_case_table_names=2 because file system for /var/folders/dX/dXCzvuSlHX4Op1g-o1jIWk+++TI/-Tmp-/FOb2ISmsvw/ is case insensitive
101203 17:54:12 [Note] Plugin 'FEDERATED' is disabled.
101203 17:54:12 [Note] Plugin 'ndbcluster' is disabled.
MySQL Version 5.5.8
Checking supported features...
 - skipping ndbcluster
 - SSL connections supported
 - binaries are debug compiled
Collecting tests...
vardir: /Users/openxs/dbs/5.5-sec/mysql-test/var
Removing old var directory...
Creating var directory '/Users/openxs/dbs/5.5-sec/mysql-test/var'...
Installing system database...
Using server port 58506

==============================================================================

TEST                                      RESULT   TIME (ms)
------------------------------------------------------------

worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 13000..13009
main.bug58695                            [ fail ]
        Test ended at 2010-12-03 17:54:21

CURRENT_TEST: main.bug58695
mysqltest: At line 1: Found junk ' ==' after $variable in expression

No crash.
[3 Dec 2010 16:01] Sven Sandberg
I'm using the latest and greatest 5.5-bugteam tree:

bzr branch my:5.5-bugteam -r revid:jonathan.perkin@oracle.com-20101203144349-wp753txg1kv2uy7r

This is the result of a recent improvement in mysqltest, it may not yet have been in any released verison.
[6 Dec 2010 13:25] Bjørn Munch
This is almost certainly a bug in or side effect of the implementation of Bug #57276, or possibly the follow-up Bug #58412. It could also be platform dependent whether or not you get a core. I will have a look.

The example code is of course syntactically wrong, but you should get an error rather than a core dump.
[6 Dec 2010 15:12] 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/126138

3123 Bjorn Munch	2010-12-06
      Bug #58695 mysqltest coredumps on "if($x == ){"
      Add check that there is a RHS of the expression
      Added to mysqltest.test
[9 Dec 2010 11:16] 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/126405

3125 Bjorn Munch	2010-12-09
      Bug #58695 mysqltest coredumps on "if($x == ){"
      Add check that there is a RHS of the expression
      Added to mysqltest.test
[9 Dec 2010 16:22] Bjørn Munch
Pushed to 5.5-mtr, trunk-mtr
[17 Dec 2010 12:51] Bugs System
Pushed into mysql-5.5 5.5.9 (revid:georgi.kodinov@oracle.com-20101217124733-p1ivu6higouawv8l) (version source revid:bjorn.munch@oracle.com-20101209195322-embe21sfutgb3oy0) (merge vers: 5.5.8) (pib:24)
[17 Dec 2010 12:55] Bugs System
Pushed into mysql-trunk 5.6.1 (revid:georgi.kodinov@oracle.com-20101217125013-y8pb3az32rtbplc9) (version source revid:anitha.gopi@sun.com-20101210041312-50t9adyhwwybsm6x) (merge vers: 5.6.1) (pib:24)
[20 Dec 2010 3:10] Paul DuBois
Changes to test suite. No changelog entry needed.