Bug #58257 mysqltest: in if(), ! $var with space is always false
Submitted: 17 Nov 2010 14:27 Modified: 7 Dec 2010 12:53
Reporter: Bjørn Munch 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

[17 Nov 2010 14:27] Bjørn Munch
When writing if() in tests, it's natural to expect this to work:

if (! $some_variable) {
  # do stuff;

But it turns out this test is always false no matter the value of $some_variable. Without space, it works correctly.

How to repeat:
Run this test without a result file:

let $var= 0;
if (! $var) {
  echo BOO;

It will fail as not having produced any output, but it should have written BOO and will if you remove the space in the if expression.
[17 Nov 2010 15:07] 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:


2951 Bjorn Munch	2010-11-17
      Bug #58257 mysqltest: in if(), ! $var with space is always false
      Evaluation would start with the space and thus ignore the $
      Added while() to skip past white space
[18 Nov 2010 17:07] Bjørn Munch
Pushed to -mtr trees
[23 Nov 2010 20:34] Paul DuBois
Changes to test suite. No changelog entry needed.
[5 Dec 2010 12:38] 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:26] 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)