Re: Random crashes while running (cmd) test runner

2011-07-04 Thread Marcus Meissner
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  wrote:
> > On Mon, Jul 04, 2011 at 12:32:47PM +0200, Frédéric Delanoy wrote:
> >> 2011/7/4 Stefan Dösinger :
> >> > 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 -
> >>
> >> (dir output)
> >>
> >> err:heap:HEAP_ValidateInUseArena Heap 0x11: 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 (0x11,7062,001c): returning 0x11c898
> > err:heap:HEAP_ValidateInUseArena Heap 0x11: block 0x11c898 tail 
> > overwritten at 0x11c8b4 (byte 0/12 == 0x64)
> > Heap: 0x11
> > Next: 0x11  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.
> 
> http://pastebin.com/6bV5BGQc


003c:Call ntdll.RtlAllocateHeap(0011,,001c) ret=7effad94
trace:heap:RtlAllocateHeap (0x11,7062,001c): returning 0x1213d8
003c:Ret  ntdll.RtlAllocateHeap() retval=001213d8 ret=7effad94
003c:Call KERNEL32.TlsGetValue() ret=7effc041
003c:Ret  KERNEL32.TlsGetValue() retval=00120b28 ret=7effc041
003c:Call KERNEL32.TlsGetValue() ret=7effc041
003c:Ret  KERNEL32.TlsGetValue() retval=00120b28 ret=7effc041
003c:Call KERNEL32.CreateFileA(7effd262 
"test.cmd",4000,,,0002,0080,) ret=7effaf5a
err:heap:HEAP_ValidateInUseArena Heap 0x11: block 0x1213d8 tail overwritten 
at 0x1213f4 (byte 0/12 == 0x64)
Heap: 0x11
Next: 0x11  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




Re: Random crashes while running (cmd) test runner

2011-07-04 Thread Frédéric Delanoy
On Mon, Jul 4, 2011 at 13:37, Marcus Meissner  wrote:
> On Mon, Jul 04, 2011 at 12:32:47PM +0200, Frédéric Delanoy wrote:
>> 2011/7/4 Stefan Dösinger :
>> > 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 -
>>
>> (dir output)
>>
>> err:heap:HEAP_ValidateInUseArena Heap 0x11: 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 (0x11,7062,001c): returning 0x11c898
> err:heap:HEAP_ValidateInUseArena Heap 0x11: block 0x11c898 tail 
> overwritten at 0x11c8b4 (byte 0/12 == 0x64)
> Heap: 0x11
> Next: 0x11  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.

http://pastebin.com/6bV5BGQc




Re: Random crashes while running (cmd) test runner

2011-07-04 Thread Marcus Meissner
On Mon, Jul 04, 2011 at 12:32:47PM +0200, Frédéric Delanoy wrote:
> 2011/7/4 Stefan Dösinger :
> > 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 -
> 
> (dir output)
> 
> err:heap:HEAP_ValidateInUseArena Heap 0x11: 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 (0x11,7062,001c): returning 0x11c898
err:heap:HEAP_ValidateInUseArena Heap 0x11: block 0x11c898 tail overwritten 
at 0x11c8b4 (byte 0/12 == 0x64)
Heap: 0x11
Next: 0x11  Sub-heaps: 0x110014
Free lists:
 Block   Stat   SizeId

It would be interesting to know what happened there in the testsuite.
You could e.g. add +relay or similar.

Ciao, Marcus




Re: Random crashes while running (cmd) test runner

2011-07-04 Thread Frédéric Delanoy
2011/7/4 Stefan Dösinger :
> 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 -

(dir output)

err:heap:HEAP_ValidateInUseArena Heap 0x11: 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




Re: Random crashes while running (cmd) test runner

2011-07-04 Thread Stefan Dösinger
-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

-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)

iQIcBAEBAgAGBQJOEXvvAAoJEN0/YqbEcdMwN6IP/RTfEAVHWl+Mj2W7IsZCaXch
RRkIf+7K0i5/55nICEFkLXyb5qGnsOWsqfsRjsjD/7ts3izOlAPYUiKWIUKAbJL/
3u8KP4R+iD6ce9KbTbh0bR6+Dp0Ma0c+qyAUBTXsZxKO6tTHUjnVtDykoLfT9hO9
Vu/XwPE+ndQjA7ctij7FnLfPSWTDzH1S+7ndpFGxAbM0zmrZKbh40NFL9PO0AD+n
teOt+lVlIjb97wPdD8gEWaHdqxFJxp1ibzzXTdF9bHZe53W31hSTJXQI7OWw+Ara
Pm2SonEztDF95tAb9MgWvlE4jyXGxe6olYIVNV6vXFpkV6CzwBePKElnLO65U5T1
wW2FGrh7KY6BrOGaKax9KVwKkHIhc5uwxFzhHhojrvjcIdJRrz4PyaD5/dEJE14o
B31xR3zM0lBvhtGFV81ytj6+RqIPoCV2MOpvk2YnkGmSnr7Y1Tpp/jz9pto28JER
0cV/u5ZKE1OSr3JnOXGCF0mybkmjzQ7JY6HV65bHl51gHCq2tNxsEIU/Z3QUwdrB
+6zm+3ZKY1NkUztBy94F9zMvhyDrMxGbAZ4Fa2JVCin98K/0zGyalj/WNlO0AaO8
SiL6ypDXcqmt/a7NxgBldNM+HQqYlupzfqtiltVx45h88O/L66gVxYLqh+hzSDqm
zr6esW7FhqYGWdGuclVO
=0F0m
-END PGP SIGNATURE-




Re: Random crashes while running (cmd) test runner

2011-07-04 Thread Marcus Meissner
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
> 
> 
> and test_builtins.cmd.exp
> dir
> 
> 
> 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 -
> 
> Directory of Z:\path\to\wine\programs\cmd\tests
> 
>  2/07/2011 20:56   .
>  2/07/2011 14:34   ..
>  2/07/2011  2:3411,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





Re: Random crashes while running (cmd) test runner [update backtrace]

2011-07-03 Thread Frédéric Delanoy
#0  0x7bc481f2 in HEAP_MakeInUseBlockFree (subheap=0x110014,
pArena=0x1106a8) at heap.c:640
#1  0x7bc4b7f5 in RtlFreeHeap (heap=0x11, flags=2, ptr=0x1106b0)
at heap.c:1757
#2  0x7bc38b12 in read_directory_stat (fd=13, io=0x33dbd0,
buffer=0x1116c8, length=8192,
single_entry=0 '\000', mask=0x1116ac, restart_scan=1 '\001',
class=FileBothDirectoryInformation) at directory.c:1936
#3  0x7bc38f3b in NtQueryDirectoryFile (handle=0x24, event=0x0, apc_routine=0,
apc_context=0x0, io=0x33dbd0, buffer=0x1116c8, length=8192,
info_class=FileBothDirectoryInformation, single_entry=0 '\000',
mask=0x1116ac,
restart_scan=1 '\001') at directory.c:2012
#4  0x7b8400aa in FindFirstFileExW (filename=0x33dccc,
level=FindExInfoStandard,
data=0x33e4cc, search_op=FindExSearchNameMatch, filter=0x0,
flags=0) at file.c:1864
#5  0x7b840a69 in FindFirstFileW (lpFileName=0x33dccc,
lpFindData=0x33e4cc) at file.c:2083
#6  0x7b859ba6 in GetLongPathNameW (shortpath=0x33ee68,
longpath=0x33e780, longlen=260)
at path.c:362
#7  0x7b861765 in create_startup_info (filename=0x33ee68,
cmdline=0x111348, cur_dir=0x0,
env=0x0, flags=0, startup=0x33f928, info_size=0x33ea40) at process.c:1595
#8  0x7b86256c in create_process (hFile=0x20, filename=0x33ee68,
cmd_line=0x111348, env=0x0,
cur_dir=0x0, psa=0x0, tsa=0x0, inherit=1, flags=0,
startup=0x33f928, info=0x33fa3c,
unixdir=0x111540
"/home/fred/.wine-tmp/dosdevices/z:/home/fred/sources/wine-git",
binary_info=0x33f070, exec_only=0) at process.c:1926
#9  0x7b8638b0 in create_process_impl (app_name=0x33f1a8, cmd_line=0x111348,
process_attr=0x0, thread_attr=0x0, inherit=1, flags=0, env=0x0,
cur_dir=0x0,
startup_info=0x33f928, info=0x33fa3c) at process.c:2274
#10 0x7b864175 in CreateProcessW (app_name=0x33f1a8,
cmd_line=0x111348, process_attr=0x0,
thread_attr=0x0, inherit=1, flags=0, env=0x0, cur_dir=0x0,
startup_info=0x33f928,
info=0x33fa3c) at process.c:2388
#11 0x7b862f95 in create_cmd_process (filename=0x33f628,
cmd_line=0x111328, env=0x0,
cur_dir=0x0, psa=0x0, tsa=0x0, inherit=1, flags=0,
startup=0x33f928, info=0x33fa3c)
at process.c:2100
#12 0x7b863c71 in create_process_impl (app_name=0x0,
cmd_line=0x111328, process_attr=0x0,
thread_attr=0x0, inherit=1, flags=0, env=0x0, cur_dir=0x0,
startup_info=0x33f928,
info=0x33fa3c) at process.c:2305
#13 0x7b864068 in CreateProcessA (app_name=0x0, cmd_line=0x33fa73 "test.cmd",
process_attr=0x0, thread_attr=0x0, inherit=1, flags=0, env=0x0,
cur_dir=0x0,
startup_info=0x33f9f8, info=0x33fa3c) at process.c:2368
#14 0x7effb19e in run_cmd (cmd_data=0x110688 "@echo off\necho should
fail\n\ndir\n\022",
cmd_size=33) at batch.c:95
#15 0x7effb9f4 in run_test (cmd_data=0x7efff52c "@echo off\necho
should fail\n\ndir\n\n",
cmd_size=28, exp_data=0x7efff548 "dir\n\n", exp_size=5) at batch.c:239
#16 0x7effbe46 in test_enum_proc (module=0x7eff, type=0x7effd4ab "TESTCMD",
name=0x110668 "TEST_BUILTINS.CMD", param=0) at batch.c:317
#17 0x7b86d748 in EnumResourceNamesA (hmod=0x7eff, type=0x7effd4ab
"TESTCMD",
lpfun=0x7effbd43 , lparam=0) at resource.c:345
#18 0x7effc008 in func_batch () at batch.c:353
#19 0x7effcc92 in run_test (name=0x7effd745 "batch") at
../../../include/wine/test.h:556
#20 0x7effd057 in main (argc=1, argv=0x1103e0) at
../../../include/wine/test.h:616
#21 0x7effd136 in __wine_spec_exe_entry (peb=0x7ffdf000) at exe_entry.c:36
#22 0x7b860008 in call_process_entry () at process.c:1035
#23 0x7b86014f in start_process (peb=0x7ffdf000) at process.c:1087
#24 0x7bc7f22c in call_thread_func () at signal_i386.c:2473
#25 0x7bc7f26a in call_thread_entry_point (entry=0x7b86000a
, arg=0x7ffdf000)
at signal_i386.c:2499
#26 0x7bc542cf in start_process (kernel_start=0x7b86000a) at loader.c:2612
#27 0xf75c0b95 in wine_call_on_stack () at port.c:60
#28 0xf75c0b73 in wine_switch_to_stack (func=0x7bc542a9
, arg=0x7b86000a,
stack=0x34) at port.c:59




Random crashes while running (cmd) test runner

2011-07-02 Thread Frédéric Delanoy
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


and test_builtins.cmd.exp
dir


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 -

Directory of Z:\path\to\wine\programs\cmd\tests

 2/07/2011 20:56   .
 2/07/2011 14:34   ..
 2/07/2011  2:3411,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=0x11, 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=0x7eff, type=0x7effd4ab "TESTCMD",
name=0x110668 "TEST_BUILTINS.CMD", param=0) at batch.c:317
#8  0x7b86d748 in EnumResourceNamesA (hmod=0x7eff, type=0x7effd4ab
"TESTCMD",
lpfun=0x7effbd43 , 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
, 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
, arg=0x7b86000a,
stack=0x34) 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