https://bugs.winehq.org/show_bug.cgi?id=37345
Bug ID: 37345 Summary: Wine does not flush stdout if stdout is redirected (Regression!) Product: Wine Version: 1.7.27 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: major Priority: P2 Component: msvcrt Assignee: wine-bugs@winehq.org Reporter: anduchs@gmail.com
When calling wine from another process after redirecting stdout to a pipe, wine does not flush the stdout-buffer correctly anymore. This is a regression.
Attached is a usecase. To test do: i686-w64-mingw32-gcc helloworld.c gcc callwine.c ./a.out
What will happen is: - on a buggy wine it will take 10 seconds and then all of the stdout-buffer is flushed on the exit of the child. (imagine the child would run longer than the 10 seconds) - on a good wine we will see some stdout-content then 10 second sleep and then the rest of the content.
This is a regesstion that happened between 1.7.4 and 1.7.5. The bisect identified commit afec0b00bd6250fe21e8deccbc8116a4aca6a7a4 "msvcrt: Make the first call to fwrite buffered." as problem.
The attached patch is a revert of this commit ported forward to 1.7.27. Unfortunately I don't quite grasp the logics of the offending commit. If somebody who knows that patch could help, I'd highly appreciate it.
Cheers, Andreas
P.S. This could be related to bug 32791.
https://bugs.winehq.org/show_bug.cgi?id=37345
Andreas anduchs@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |regression, source, | |testcase CC| |anduchs@gmail.com Regression SHA1| |afec0b00bd6250fe21e8deccbc8 | |116a4aca6a7a4
https://bugs.winehq.org/show_bug.cgi?id=37345
--- Comment #1 from Andreas anduchs@gmail.com --- Created attachment 49661 --> https://bugs.winehq.org/attachment.cgi?id=49661 helloworld.c
The Windows-Side of the TestCase
https://bugs.winehq.org/show_bug.cgi?id=37345
--- Comment #2 from Andreas anduchs@gmail.com --- Created attachment 49662 --> https://bugs.winehq.org/attachment.cgi?id=49662 callwine.c
The linux (wrapper) side of the TestCase
https://bugs.winehq.org/show_bug.cgi?id=37345
--- Comment #3 from Andreas anduchs@gmail.com --- Created attachment 49663 --> https://bugs.winehq.org/attachment.cgi?id=49663 Revert-msvcrt-Make-the-first-call-to-fwrite-buffered.patch
Revert-patch of the regression-introducing commit.
https://bugs.winehq.org/show_bug.cgi?id=37345
Andreas Fuchs anduchs@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID
--- Comment #4 from Andreas Fuchs anduchs@gmail.com --- Redirected (non-pty-stdouts) are supposed to be buffered...
My personal fix is now basically:
callwine.c: - int ret = pipe(winestdout); + int ret = openpty(&winestdout[0], &winestdout[1], NULL, NULL, NULL);
In case anyone else runs into this at some point...
https://bugs.winehq.org/show_bug.cgi?id=37345
Bruno Jesus 00cpxxx@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #5 from Bruno Jesus 00cpxxx@gmail.com --- Closing invalid bugs.