Bug #48671 mysqltest fails on 'perl' inside 'while'
Submitted: 10 Nov 2009 15:43 Modified: 17 Jun 2010 19:27
Reporter: Sven Sandberg Email Updates:
Status: Closed Impact on me:
None 
Category:Tools: MTR / mysql-test-run Severity:S7 (Test Cases)
Version:5.1 OS:Any
Assigned to: Bjørn Munch CPU Architecture:Any
Tags: mysqltest

[10 Nov 2009 15:43] Sven Sandberg
Description:
If a test file contains a 'while' command, and inside the 'while' loop there is a 'source' command, and the sourced file contains a 'perl' command, then mysqltest fails with the error message "End of file encountered before 'EOF' delimiter was found".

How to repeat:
==== file_1.test ====
perl;
  my $y=1;
EOF
}
==== end of file_1.test ====

==== file_2.test ====
while (1) {
  source file_1.test;
}
==== end of file_2.test ====

If file_1 is run separately, it succeeds. If file_2 is executed, it fails with the error message "End of file encountered before 'EOF' delimiter was found".
[11 Nov 2009 9:34] Bjørn Munch
This is not related to source: "perl" does not work in a while which is looped over more than once.

This has previously been fixed for append_file and write_file in Bug #32296, need to (and probably can) use the same method to fix for the perl command as well.
[11 Nov 2009 11:47] 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/90079

2853 Bjorn Munch	2009-11-11
      Bug #48671 mysqltest fails on 'perl' in file sourced inside 'while'
      Actually, fails on 'perl' in any while
      Fixed essentially the same way as for append_file
[18 Nov 2009 13:24] Joerg Bruehe
The old code had a line
    dynstr_free(&ds_script);

While I understand it may be wrong at this place (because of loops),
I still would like to see it moved to the proper place
(or get an explanation why this cannot be done, and how severe this memory leak would be).
[18 Nov 2009 13:30] Bjørn Munch
The old dynstr_free call is done by these lines in void free_used_memory():

+    if ((*q)->content.str)
+      dynstr_free(&(*q)->content);

This was added in the related fix for Bug #32296 and also applies to ds_script here.
[18 Nov 2009 14:55] Joerg Bruehe
Ok then - I had checked this patch in isolation.
Approved.
[19 Nov 2009 11:28] Bjørn Munch
Pushed to 5.1-mtr, trunk-mtr, next-mr-mtr, 6.0-codebase-mtr
[20 Feb 2010 9:31] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100220092844-jh07ayojyxn8uh9p) (version source revid:bjorn.munch@sun.com-20091119111729-sazk6qfk8qbwfq0y) (merge vers: 6.0.14-alpha) (pib:16)
[20 Feb 2010 9:34] Bugs System
Pushed into 5.5.3-m2 (revid:alik@sun.com-20100220092622-wvhh1vfy5tjq4mhu) (version source revid:bjorn.munch@sun.com-20091119092424-cpc87ef58xms6o9b) (merge vers: 5.5.0-beta) (pib:16)
[20 Feb 2010 9:36] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100220092730-paoo5t9gcajs5dq8) (version source revid:bjorn.munch@sun.com-20091119092557-tm3cmjhd1jnlj0qc) (pib:16)
[23 Feb 2010 2:09] Paul DuBois
Changes to test suite. No changelog entry needed.

Setting report to Need Merge pending push to 5.1.x, Celosia.
[1 Mar 2010 8:44] Bugs System
Pushed into 5.1.45 (revid:joro@sun.com-20100301083827-xnimmrjg6bh33o1o) (version source revid:azundris@mysql.com-20100222175719-viuh0f3gdsrkgv0r) (merge vers: 5.1.45) (pib:16)
[1 Mar 2010 16:22] Paul DuBois
No changelog entry needed.
[17 Jun 2010 12:16] Bugs System
Pushed into 5.1.47-ndb-7.0.16 (revid:martin.skold@mysql.com-20100617114014-bva0dy24yyd67697) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[17 Jun 2010 13:03] Bugs System
Pushed into 5.1.47-ndb-6.2.19 (revid:martin.skold@mysql.com-20100617115448-idrbic6gbki37h1c) (version source revid:martin.skold@mysql.com-20100609140708-52rvuyq4q500sxkq) (merge vers: 5.1.45-ndb-6.2.19) (pib:16)
[17 Jun 2010 13:44] Bugs System
Pushed into 5.1.47-ndb-6.3.35 (revid:martin.skold@mysql.com-20100617114611-61aqbb52j752y116) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)