Bug #10267 | mysqltest, wrong number of loops when a script is sourced within a loop | ||
---|---|---|---|
Submitted: | 29 Apr 2005 16:42 | Modified: | 1 Sep 2005 19:20 |
Reporter: | Matthias Leich | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Command-line Clients | Severity: | S3 (Non-critical) |
Version: | 4.1 | OS: | |
Assigned to: | Magnus Blåudd | CPU Architecture: | Any |
[29 Apr 2005 16:42]
Matthias Leich
[29 Apr 2005 16:44]
Matthias Leich
sourced test script
Attachment: ml60i.sub (application/octet-stream, text), 53 bytes.
[29 Apr 2005 16:44]
Matthias Leich
test case
Attachment: ml60.test (application/test, text), 881 bytes.
[7 Jul 2005 9:22]
Matthias Leich
I have another testcase with nested scripts within a loop where mysqltest crashes. I guess this crash is another representation of this bug. # Sourcing of files within a while loop. # include/ml031.inc sources include/ml0311.inc # The loops are harmless until $num exceeds 8 . let $num= 9; while ($num) { SELECT 'In loop' AS ""; --source include/ml031.inc dec $num; } GDB: (I hope that I started gdb with the correct options.) Core was generated by `/home/matthias/Arbeit/mysql-5.0/src-B/client/.libs/lt-mysqltest --no-defaults -'. Program terminated with signal 11, Segmentation fault. ... (gdb) bt #0 0x403860db in getc () from /lib/tls/libc.so.6 #1 0x0804f6b6 in my_getc (file=0x0) at mysqltest.c:2050 #2 0x0804f828 in read_line (buf=0x8068b20 "SELECT 'Leaving include/ml0311.inc' AS \"\"", size=131072) at mysqltest.c:2098 #3 0x0804fddb in read_query (q_ptr=0xbfffe228) at mysqltest.c:2260 #4 0x08053956 in main (argc=13, argv=0xbfffe2c4) at mysqltest.c:3770 (gdb) Workaround 1: Alter mysqltest.c from #define MAX_INCLUDE_DEPTH 16 to 32. But this is no real bug fix, because the number of logical open files is independend of the number of loops and definitely below 16. Workaround 2: Alter the testscript and replace the while loop by the necessary number of --source .... --source .... But that's bad testscript architecture :(
[7 Jul 2005 9:23]
Matthias Leich
testscripts
Attachment: ml031.test (application/test, text), 320 bytes.
[7 Jul 2005 9:24]
Matthias Leich
testscript
Attachment: ml031.inc (application/octet-stream, text), 117 bytes.
[7 Jul 2005 9:25]
Matthias Leich
testscript
Attachment: ml0311.inc (application/octet-stream, text), 100 bytes.
[16 Aug 2005 11:58]
Magnus Blåudd
Problem occurs becuse the dynamic array q_lines that contains a cache of already read lines are overwritten by the lines read from the sourced file.
[16 Aug 2005 15:11]
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/28339
[1 Sep 2005 19:20]
Paul DuBois
No changelog entry needed.