Bug #32296 mysqltest fails to parse "append_file" inside a "while", it works inside a "if"
Submitted: 12 Nov 2007 21:20 Modified: 18 Dec 2009 13:18
Reporter: Guilhem Bichot Email Updates:
Status: Closed Impact on me:
None 
Category:Tools: MTR / mysql-test-run Severity:S3 (Non-critical)
Version:5.1-bk OS:Linux
Assigned to: Bjørn Munch CPU Architecture:Any

[12 Nov 2007 21:20] Guilhem Bichot
Description:
if (1)
{
append_file $MYSQLTEST_VARDIR/tmp/master0.expect;
wait
EOF
echo one;
}

echo ok;

Running the above test (with --record) goes ok.
Changing "if" to "while" one gets:
mysqltest: At line 7: End of file encountered before 'EOF' delimiter was found

Debugging shows that it's the second iteration of the loop which fails to parse: the read_until_delimiter() starts its search from the blank line before "echo ok", no wonder it does not meet the EOF delimiter.
The example above has an infinite loop but comes from a real-life problem.

How to repeat:
see description
[13 Jul 2009 12:40] Sven Sandberg
BUG#41913 seems related.
[29 Jul 2009 13:36] 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/79530

2810 Bjorn Munch	2009-07-29
      Bug #32296 mysqltest fails to parse "append_file" inside a "while", it works inside a "if"
      Bug #41913 mysqltest cannot source files from if inside while
      Some commands require additional processing which only works first time
      Keep content for write_file or append_file with the st_command struct
[29 Jul 2009 13:41] Bjørn Munch
The extra field in struct st_command is only used by append_file or write_file, and only *needed* by those if in a while loop, so it might seem a bit overkill. It seems the easiest way to manage it though.
[27 Aug 2009 10:45] Magnus Blåudd
You should probably also add a test to mysqltest.test
[31 Aug 2009 12: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/81994

2826 Bjorn Munch	2009-08-31
      Bug #32296 mysqltest fails to parse "append_file" inside a "while", it works inside a "if"
      Bug #41913 mysqltest cannot source files from if inside while
      Some commands require additional processing which only works first time
      Keep content for write_file or append_file with the st_command struct
      Add tests for those cases to mysqltest.test
[2 Sep 2009 9:18] 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/82187

2830 Bjorn Munch	2009-09-02
      Bug #32296 mysqltest fails to parse "append_file" inside a "while", it works inside
      a "if"
      Bug #41913 mysqltest cannot source files from if inside while
      Some commands require additional processing which only works first time
      Keep content for write_file or append_file with the st_command struct
      Add tests for those cases to mysqltest.test
[2 Sep 2009 10:45] Bjørn Munch
Confirmed OK on IRC after my latest patch

Pushed to azalea-mtr (sson to be next-mtr) and 5.1-mtr
[3 Sep 2009 17:12] Bugs System
Pushed into 5.1.40 (revid:bjorn.munch@sun.com-20090903170735-679d64zp580wl39j) (version source revid:bjorn.munch@sun.com-20090903170735-679d64zp580wl39j) (merge vers: 5.1.40) (pib:11)
[4 Sep 2009 0:50] Paul DuBois
Test suite change. No changelog entry needed.

Setting report to NDI pending push into 5.4.x.
[30 Sep 2009 8:16] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20090929093622-1mooerbh12e97zux) (version source revid:alik@sun.com-20090922182109-vs5ign07cwht12z6) (merge vers: 6.0.14-alpha) (pib:11)
[30 Sep 2009 8:20] Bugs System
Pushed into 5.4.5-beta (revid:alik@sun.com-20090925094254-tjl9eajkzwzgthoe) (version source revid:alik@sun.com-20090922142453-x275o41whpyezh4q) (merge vers: 5.4.4-beta) (pib:11)
[30 Sep 2009 19:46] Paul DuBois
Test suite change. No changelog entry needed.
[18 Dec 2009 10:29] Bugs System
Pushed into 5.1.41-ndb-7.1.0 (revid:jonas@mysql.com-20091218102229-64tk47xonu3dv6r6) (version source revid:jonas@mysql.com-20091218095730-26gwjidfsdw45dto) (merge vers: 5.1.41-ndb-7.1.0) (pib:15)
[18 Dec 2009 10:45] Bugs System
Pushed into 5.1.41-ndb-6.2.19 (revid:jonas@mysql.com-20091218100224-vtzr0fahhsuhjsmt) (version source revid:jonas@mysql.com-20091217101452-qwzyaig50w74xmye) (merge vers: 5.1.41-ndb-6.2.19) (pib:15)
[18 Dec 2009 11:01] Bugs System
Pushed into 5.1.41-ndb-6.3.31 (revid:jonas@mysql.com-20091218100616-75d9tek96o6ob6k0) (version source revid:jonas@mysql.com-20091217154335-290no45qdins5bwo) (merge vers: 5.1.41-ndb-6.3.31) (pib:15)
[18 Dec 2009 11:15] Bugs System
Pushed into 5.1.41-ndb-7.0.11 (revid:jonas@mysql.com-20091218101303-ga32mrnr15jsa606) (version source revid:jonas@mysql.com-20091218064304-ezreonykd9f4kelk) (merge vers: 5.1.41-ndb-7.0.11) (pib:15)
[18 Dec 2009 13:18] Paul DuBois
Test suite change. No changelog entry needed.