http://bugs.winehq.org/show_bug.cgi?id=31057
--- Comment #18 from Roman Kagan rkagan@mail.ru 2013-11-11 03:22:13 CST --- I seem to have narrowed it down to a problem with msvcrt.ungetwc() on a file lacking BOM:
with BOM (working):
# echo -e '\xef\xbb\xbfall:\n\techo ok' > Makefile # WINEDEBUG=trace+relay wine nmake.exe 2>&1 | grep -F msvcrt. ... 0009:Call msvcrt._wfsopen(0012ed70 L"makefile",00401368 L"rt,ccs=unicode",00000020) ret=0040a88e 0009:Ret msvcrt._wfsopen() retval=7ef14220 ret=0040a88e 0009:Call msvcrt.fgetwc(7ef14220) ret=00407fd8 0009:Ret msvcrt.fgetwc() retval=00000061 ret=00407fd8 0009:Call msvcrt.ungetwc(00000061,7ef14220) ret=0040a358 0009:Ret msvcrt.ungetwc() retval=00000061 ret=0040a358 0009:Call msvcrt.fgetwc(7ef14220) ret=00407fd8 0009:Ret msvcrt.fgetwc() retval=00000061 ret=00407fd8 0009:Call msvcrt.fgetwc(7ef14220) ret=00407fd8 0009:Ret msvcrt.fgetwc() retval=0000006c ret=00407fd8 0009:Call msvcrt.fgetwc(7ef14220) ret=00407fd8 0009:Ret msvcrt.fgetwc() retval=0000006c ret=00407fd8 0009:Call msvcrt.fgetwc(7ef14220) ret=00407fd8 0009:Ret msvcrt.fgetwc() retval=0000003a ret=00407fd8 0009:Call msvcrt.ungetwc(0000003a,7ef14220) ret=00409b56 0009:Ret msvcrt.ungetwc() retval=0000003a ret=00409b56 0009:Call msvcrt._wcsicmp(00422178 L"all",0040178c L"include") ret=0040a23a 0009:Ret msvcrt._wcsicmp() retval=fffffff8 ret=0040a23a ...
without BOM (non-working):
# echo -e 'all:\n\techo ok' > Makefile # WINEDEBUG=trace+relay wine nmake.exe 2>&1 | grep -F msvcrt. ... 0009:Call msvcrt._wfsopen(0012ed70 L"makefile",00401368 L"rt,ccs=unicode",00000020) ret=0040a88e 0009:Ret msvcrt._wfsopen() retval=7ef07220 ret=0040a88e 0009:Call msvcrt.fgetwc(7ef07220) ret=00407fd8 0009:Ret msvcrt.fgetwc() retval=00000061 ret=00407fd8 0009:Call msvcrt.ungetwc(00000061,7ef07220) ret=0040a358 0009:Ret msvcrt.ungetwc() retval=ffffffff ret=0040a358 0009:Call msvcrt.fgetwc(7ef07220) ret=00407fd8 0009:Ret msvcrt.fgetwc() retval=00000000 ret=00407fd8 0009:Call msvcrt.fgetwc(7ef07220) ret=00407fd8 0009:Ret msvcrt.fgetwc() retval=0000006c ret=00407fd8 0009:Call msvcrt.fgetwc(7ef07220) ret=00407fd8 0009:Ret msvcrt.fgetwc() retval=0000006c ret=00407fd8 0009:Call msvcrt.fgetwc(7ef07220) ret=00407fd8 0009:Ret msvcrt.fgetwc() retval=0000003a ret=00407fd8 0009:Call msvcrt.ungetwc(0000003a,7ef07220) ret=00409b56 0009:Ret msvcrt.ungetwc() retval=0000003a ret=00409b56 0009:Call msvcrt._wcsicmp(00422178 L"",0040178c L"include") ret=0040a23a 0009:Ret msvcrt._wcsicmp() retval=ffffff97 ret=0040a23a ...
Note that in the latter case ungetwc() fails but apparently nmake ignores the error, then the following fgetwc() returns null, which screws up everything else.