| Bug #12959 | mysqltest crashes if testcase passed with -x option | ||
|---|---|---|---|
| Submitted: | 2 Sep 2005 23:01 | Modified: | 6 Sep 2005 15:51 |
| Reporter: | Alexey Stroganov | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Command-line Clients | Severity: | S1 (Critical) |
| Version: | the latest 5.0.13pre | OS: | Any (All) |
| Assigned to: | Magnus BlÄudd | CPU Architecture: | Any |
[5 Sep 2005 14:50]
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/internals/29330
[6 Sep 2005 7:40]
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/internals/29345
[20 Sep 2005 12:15]
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/internals/30098

Description: Working on stress test I found that if one will pass test case not to stdin but specify with -x option mysqltest will crashes or in debug version will exit with assert. Problem was not found as in mysql-test-run we pass test cases to stdin but in my test script I used -x option. How to repeat: Run mysqltest with -x option or just find in mysql-test-run script follow string $MYSQL_TEST $mysql_test_args < $tf 2> $TIMEFILE and replace it with this line $MYSQL_TEST $mysql_test_args -x $tf 2> $TIMEFILE Then run mysql-test-run <any testcase> and test will fail. Suggested fix: I tracked down the problem and below patch that fix issue. --- /mnt/md/bk/mysql-5.0/client/mysqltest.c 2005-09-01 23:37:45 +0300 +++ mysqltest.c 2005-09-03 02:46:09 +0300 @@ -2381,6 +2381,7 @@ my_fclose(cur_file->file, MYF(0)); my_free((gptr)cur_file->file_name, MYF(MY_ALLOW_ZERO_PTR)); cur_file->file_name= 0; + cur_file--; lineno--; start_lineno= *lineno; if (cur_file == file_stack) @@ -2396,7 +2397,6 @@ DBUG_PRINT("info", ("end of file")); DBUG_RETURN(1); } - cur_file--; continue; } @@ -2752,6 +2752,7 @@ argument= buff; } fn_format(buff, argument, "", "", 4); + cur_file++; DBUG_ASSERT(cur_file->file == 0); if (!(cur_file->file= my_fopen(buff, O_RDONLY | FILE_BINARY, MYF(MY_WME)))) @@ -4024,6 +4025,7 @@ die("Can't initialize MySQL server"); if (cur_file == file_stack) { + cur_file++; DBUG_ASSERT(cur_file->file == 0); cur_file->file= stdin; cur_file->file_name= my_strdup("<stdin>", MYF(MY_WME));