Hi folks,
I'm in the process of writing a couple of cmd tests (on top of master, not of my currently pending patches), and I at times have problems where none of the tests is actually performed, but the test suite still returns without any error indication, e.g.
batch.c:306: running TEST_BUILTINS.CMD test... batch: 7 tests executed (0 marked as todo, 0 failures), 0 skipped.
which many more tests should be performed
After checking with "winedbg --gdb" it gets a SIGSEGV
I tried to reproduce with a mimimal output file and expected file, and get weird results. Say you have the following files:
test_builtins.cmd @echo off echo should fail <empty line>
and test_builtins.cmd.exp dir <empty line>
When I run make testclean && make test in programs/cmd/tests, I get the following (first line of .exp file executed somehow...)
batch.c:215: Test failed: unexpected char 0x73 position 0 in line 1 (got 'should fail', wanted 'dir') batch.c:227: Test failed: too long output, got additional Volume Serial Number is 0000-0000
Directory of Z:\path\to\wine\programs\cmd\tests
2/07/2011 20:56 <DIR> . 2/07/2011 14:34 <DIR> .. 2/07/2011 2:34 11,074 batch.c <...>
batch: 14 tests executed (0 marked as todo, 2 failures), 0 skipped.
If I run "/wine winedbg --gdb programs/cmd/tests/cmd.exe_test.exe.so" and run (c)ont, I get a SIGSEGV:
Program received signal SIGSEGV, Segmentation fault. 0x7bc481f2 in HEAP_MakeInUseBlockFree (subheap=0x110014, pArena=0x1106a8) at heap.c:640 640 size += (pFree->size & ARENA_SIZE_MASK) + sizeof(ARENA_FREE);
Full backtrace: #0 0x7bc481f2 in HEAP_MakeInUseBlockFree (subheap=0x110014, pArena=0x1106a8) at heap.c:640 #1 0x7bc4b7f5 in RtlFreeHeap (heap=0x110000, flags=2, ptr=0x1106b0) at heap.c:1757 #2 0x7bc6ed27 in RtlFreeUnicodeString (str=0x33f8fc) at rtlstr.c:319 #3 0x7b83f06c in CreateFileW (filename=0x7ffd8c00, access=1073741824, sharing=0, sa=0x0, creation=2, attributes=128, template=0x0) at file.c:1421 #4 0x7b83f14a in CreateFileA (filename=0x7effd262 "test.cmd", access=1073741824, sharing=0, sa=0x0, creation=2, attributes=128, template=0x0) at file.c:1443 #5 0x7effaf5a in run_cmd (cmd_data=0x110688 "@echo off\necho should fail\n\n\ndirb", cmd_size=34) at batch.c:68 #6 0x7effb9f4 in run_test (cmd_data=0x7efff52c "@echo off\necho should fail\n\n\ndir\n\n", cmd_size=28, exp_data=0x7efff548 "\ndir\n\n", exp_size=6) at batch.c:239 #7 0x7effbe46 in test_enum_proc (module=0x7eff0000, type=0x7effd4ab "TESTCMD", name=0x110668 "TEST_BUILTINS.CMD", param=0) at batch.c:317 #8 0x7b86d748 in EnumResourceNamesA (hmod=0x7eff0000, type=0x7effd4ab "TESTCMD", lpfun=0x7effbd43 <test_enum_proc>, lparam=0) at resource.c:345 #9 0x7effc008 in func_batch () at batch.c:353 #10 0x7effcc92 in run_test (name=0x7effd745 "batch") at ../../../include/wine/test.h:556 #11 0x7effd057 in main (argc=1, argv=0x1103e0) at ../../../include/wine/test.h:616 #12 0x7effd136 in __wine_spec_exe_entry (peb=0x7ffdf000) at exe_entry.c:36 #13 0x7b860008 in call_process_entry () at process.c:1035 #14 0x7b86014f in start_process (peb=0x7ffdf000) at process.c:1087 #15 0x7bc7f22c in call_thread_func () at signal_i386.c:2473 #16 0x7bc7f26a in call_thread_entry_point (entry=0x7b86000a <start_process>, arg=0x7ffdf000) at signal_i386.c:2499 #17 0x7bc542cf in start_process (kernel_start=0x7b86000a) at loader.c:2612 #18 0xf7609b95 in wine_call_on_stack () at port.c:60 #19 0xf7609b73 in wine_switch_to_stack (func=0x7bc542a9 <start_process>, arg=0x7b86000a, stack=0x340000) at port.c:59 Backtrace stopped: previous frame inner to this frame (corrupt stack?)
Does anyone know what's going wrong exactly?
Frédéric
Note: wine-1.3.23-164-ge18c15d compiled with "-O0 -g" on Natty x86_64
On Sat, Jul 02, 2011 at 09:31:52PM +0200, Frédéric Delanoy wrote:
Hi folks,
I'm in the process of writing a couple of cmd tests (on top of master, not of my currently pending patches), and I at times have problems where none of the tests is actually performed, but the test suite still returns without any error indication, e.g.
batch.c:306: running TEST_BUILTINS.CMD test... batch: 7 tests executed (0 marked as todo, 0 failures), 0 skipped.
which many more tests should be performed
After checking with "winedbg --gdb" it gets a SIGSEGV
I tried to reproduce with a mimimal output file and expected file, and get weird results. Say you have the following files:
test_builtins.cmd @echo off echo should fail
<empty line>
and test_builtins.cmd.exp dir
<empty line>
When I run make testclean && make test in programs/cmd/tests, I get the following (first line of .exp file executed somehow...)
batch.c:215: Test failed: unexpected char 0x73 position 0 in line 1 (got 'should fail', wanted 'dir') batch.c:227: Test failed: too long output, got additional Volume Serial Number is 0000-0000
Directory of Z:\path\to\wine\programs\cmd\tests
2/07/2011 20:56 <DIR> . 2/07/2011 14:34 <DIR> .. 2/07/2011 2:34 11,074 batch.c <...>
batch: 14 tests executed (0 marked as todo, 2 failures), 0 skipped.
If I run "/wine winedbg --gdb programs/cmd/tests/cmd.exe_test.exe.so" and run (c)ont, I get a SIGSEGV:
Program received signal SIGSEGV, Segmentation fault. 0x7bc481f2 in HEAP_MakeInUseBlockFree (subheap=0x110014, pArena=0x1106a8) at heap.c:640 640 size += (pFree->size & ARENA_SIZE_MASK) + sizeof(ARENA_FREE);
If you could run this with
export WINEDEBUG=+heap
This should show the heap corruption way earlier, but gets a lot of debugoutput. Redirect to a file, and look for the first instancnes of corruption. Add more debugging to WINEDEBUG to see where it does fail...
Ciao, Marcus
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Am 04.07.2011 um 10:28 schrieb Marcus Meissner:
export WINEDEBUG=+heap
WINEDEBUG=warn+heap adds the corruption checking but not the debug output
2011/7/4 Stefan Dösinger stefandoesinger@gmx.at:
Am 04.07.2011 um 10:28 schrieb Marcus Meissner:
export WINEDEBUG=+heap
WINEDEBUG=warn+heap adds the corruption checking but not the debug output
I get the following: batch.c:306: running TEST_BUILTINS.CMD test... batch.c:215: Test failed: unexpected char 0x73 position 0 in line 1 (got 'should fail', wanted 'dir') batch.c:227: Test failed: too long output, got additional Volume Serial Number is 0000-0000
(dir output)
err:heap:HEAP_ValidateInUseArena Heap 0x110000: block 0x11c8a0 tail overwritten at 0x11c8bc (byte 0/12 == 0x64) batch: 14 tests executed (0 marked as todo, 2 failures), 0 skipped.
See http://pastebin.com/T4E63M5S for full log and heap dump
Frédéric
On Mon, Jul 04, 2011 at 12:32:47PM +0200, Frédéric Delanoy wrote:
2011/7/4 Stefan Dösinger stefandoesinger@gmx.at:
Am 04.07.2011 um 10:28 schrieb Marcus Meissner:
export WINEDEBUG=+heap
WINEDEBUG=warn+heap adds the corruption checking but not the debug output
I get the following: batch.c:306: running TEST_BUILTINS.CMD test... batch.c:215: Test failed: unexpected char 0x73 position 0 in line 1 (got 'should fail', wanted 'dir') batch.c:227: Test failed: too long output, got additional Volume Serial Number is 0000-0000
(dir output)
err:heap:HEAP_ValidateInUseArena Heap 0x110000: block 0x11c8a0 tail overwritten at 0x11c8bc (byte 0/12 == 0x64) batch: 14 tests executed (0 marked as todo, 2 failures), 0 skipped.
See http://pastebin.com/T4E63M5S for full log and heap dump
The first error appears around line 328:
trace:heap:RtlAllocateHeap (0x110000,70000062,0000001c): returning 0x11c898 err:heap:HEAP_ValidateInUseArena Heap 0x110000: block 0x11c898 tail overwritten at 0x11c8b4 (byte 0/12 == 0x64) Heap: 0x110000 Next: 0x110000 Sub-heaps: 0x110014 Free lists: Block Stat Size Id
It would be interesting to know what happened there in the testsuite. You could e.g. add +relay or similar.
Ciao, Marcus
On Mon, Jul 4, 2011 at 13:37, Marcus Meissner meissner@suse.de wrote:
On Mon, Jul 04, 2011 at 12:32:47PM +0200, Frédéric Delanoy wrote:
2011/7/4 Stefan Dösinger stefandoesinger@gmx.at:
Am 04.07.2011 um 10:28 schrieb Marcus Meissner:
export WINEDEBUG=+heap
WINEDEBUG=warn+heap adds the corruption checking but not the debug output
I get the following: batch.c:306: running TEST_BUILTINS.CMD test... batch.c:215: Test failed: unexpected char 0x73 position 0 in line 1 (got 'should fail', wanted 'dir') batch.c:227: Test failed: too long output, got additional Volume Serial Number is 0000-0000
(dir output)
err:heap:HEAP_ValidateInUseArena Heap 0x110000: block 0x11c8a0 tail overwritten at 0x11c8bc (byte 0/12 == 0x64) batch: 14 tests executed (0 marked as todo, 2 failures), 0 skipped.
See http://pastebin.com/T4E63M5S for full log and heap dump
The first error appears around line 328:
trace:heap:RtlAllocateHeap (0x110000,70000062,0000001c): returning 0x11c898 err:heap:HEAP_ValidateInUseArena Heap 0x110000: block 0x11c898 tail overwritten at 0x11c8b4 (byte 0/12 == 0x64) Heap: 0x110000 Next: 0x110000 Sub-heaps: 0x110014 Free lists: Block Stat Size Id
It would be interesting to know what happened there in the testsuite. You could e.g. add +relay or similar.
On Mon, Jul 04, 2011 at 02:01:31PM +0200, Frédéric Delanoy wrote:
On Mon, Jul 4, 2011 at 13:37, Marcus Meissner meissner@suse.de wrote:
On Mon, Jul 04, 2011 at 12:32:47PM +0200, Frédéric Delanoy wrote:
2011/7/4 Stefan Dösinger stefandoesinger@gmx.at:
Am 04.07.2011 um 10:28 schrieb Marcus Meissner:
export WINEDEBUG=+heap
WINEDEBUG=warn+heap adds the corruption checking but not the debug output
I get the following: batch.c:306: running TEST_BUILTINS.CMD test... batch.c:215: Test failed: unexpected char 0x73 position 0 in line 1 (got 'should fail', wanted 'dir') batch.c:227: Test failed: too long output, got additional Volume Serial Number is 0000-0000
(dir output)
err:heap:HEAP_ValidateInUseArena Heap 0x110000: block 0x11c8a0 tail overwritten at 0x11c8bc (byte 0/12 == 0x64) batch: 14 tests executed (0 marked as todo, 2 failures), 0 skipped.
See http://pastebin.com/T4E63M5S for full log and heap dump
The first error appears around line 328:
trace:heap:RtlAllocateHeap (0x110000,70000062,0000001c): returning 0x11c898 err:heap:HEAP_ValidateInUseArena Heap 0x110000: block 0x11c898 tail overwritten at 0x11c8b4 (byte 0/12 == 0x64) Heap: 0x110000 Next: 0x110000 Sub-heaps: 0x110014 Free lists: Block Stat Size Id
It would be interesting to know what happened there in the testsuite. You could e.g. add +relay or similar.
003c:Call ntdll.RtlAllocateHeap(00110000,00000000,0000001c) ret=7effad94 trace:heap:RtlAllocateHeap (0x110000,70000062,0000001c): returning 0x1213d8 003c:Ret ntdll.RtlAllocateHeap() retval=001213d8 ret=7effad94 003c:Call KERNEL32.TlsGetValue(00000000) ret=7effc041 003c:Ret KERNEL32.TlsGetValue() retval=00120b28 ret=7effc041 003c:Call KERNEL32.TlsGetValue(00000000) ret=7effc041 003c:Ret KERNEL32.TlsGetValue() retval=00120b28 ret=7effc041 003c:Call KERNEL32.CreateFileA(7effd262 "test.cmd",40000000,00000000,00000000,00000002,00000080,00000000) ret=7effaf5a err:heap:HEAP_ValidateInUseArena Heap 0x110000: block 0x1213d8 tail overwritten at 0x1213f4 (byte 0/12 == 0x64) Heap: 0x110000 Next: 0x110000 Sub-heaps: 0x110014
As it happens right before the test.cmd creation, it is very likely the function static const char* replace_escaped_spaces(const char *data, DWORD size, DWORD *new_size)
At least the final \0 seems not to be counted during the HeapAlloc() in this function, perhaps just adding +1 in the HeapAlloc() will help.
Ciao, Marcus