http://bugs.winehq.org/show_bug.cgi?id=33654
Bug #: 33654 Summary: MSYS bash.exe redirection fails for ctest.exe (one of the CMake executables). Regression of recent wine-git from 1.5.25 Product: Wine Version: 1.5.31 Platform: x86-64 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: msvcrt AssignedTo: wine-bugs@winehq.org ReportedBy: irwin@beluga.phys.uvic.ca Classification: Unclassified
Created attachment 44546 --> http://bugs.winehq.org/attachment.cgi?id=44546 Source code for "DoNotInheritStdPipes" redirection test
Under MSYS bash.exe, redirection of the ctest.exe command produces an empty file for wine-1.5.31 but not for wine-1.5.19 (very heavily tested for my build needs) or wine-1.5.25 (lightly tested for this specific problem). For example, in 1.5.31, but not 1.5.25 (or 1.5.19),
ctest.exe --version
gives the correct result ("ctest version 2.8.10.2") to the console created by wineconsole, but
ctest.exe --version > ctest_version.out
produces an empty file.
"git bisect" shows the first wine commit to cause the problem was the first one after 1.5.25 (f565e4a3157d38b50a25fc3b90014474b59fceba, msvcrt: Don't duplicate standard handles during initialization.) Subsequently there was a style change (8e5bebe26253f2725141a35f23b6f2e10fc7694d, msvcrt: Rename msvcrt_alloc_fd_from to msvcrt_set_fd.) to the affected file, dlls/msvcrt/file.c. Both these commits were by Piotr Caban piotr@codeweavers.com. If I revert 8e5bebe26253f2725141a35f23b6f2e10fc7694d and f565e4a3157d38b50a25fc3b90014474b59fceba for wine-1.5.31 (note the reversed patches apply cleanly), this fixes the issue.
To save wine developers having to dig around in the ctest code source from CMake to figure out what Windows calls are being used to trigger this wine regression, I attach standalone code for a simple test case which follows what is done in ctest to handle stdout. When this code is compiled with MinGW it demonstrates the same redirection issue you get with ctest. The only difference from a standard C++ "Hello World" programme in this test code is the call to DoNotInheritStdPipes which I just copied from the ctest source code. I don't understand DoNotInheritStdPipes, but one of the commit messages associated with it when it was implemented in 2007 by the CMake developers had the title "BUG: fix problem with stdout and stderr not showing up in ms dos shells". Anyhow, since 2007 DoNotInheritStdPipes has apparently been used for executing ctest.exe on Microsoft Windows with no redirection issues on that platform and that implies commit f565e4... causes a run-time difference between the Wine and Microsoft versions of Windows. But I have no access to Microsoft Windows myself so that implication should be confirmed by compiling the attached source code on Microsoft Windows and showing that redirection works fine with it under MSYS bash.exe for that platform but not for wine-1.5.31 unless the two above patches (one just a style one) are reverted.