http://bugs.winehq.org/show_bug.cgi?id=13861
Summary: Use of stdio functions in wine programs Product: Wine Version: 1.0-rc4 Platform: All OS/Version: All Status: UNCONFIRMED Severity: enhancement Priority: P1 Component: programs AssignedTo: wine-bugs@winehq.org ReportedBy: wine@mkarcher.dialup.fu-berlin.de
Winelib applications get linked to native libc (not msvcrt), and thus use native stdio. This is a problem if these winelib applications are run from a wineconsole (user backend), as native linux libc does not send the output to stdio to wineserver, but to the terminal wineconsole was started from. This is, in my oppinion, an undesired effect.
Following programs use printf(...), fprintf(stderr,...) - uninstaller - msiexec - regsvr32 - net - winepath - winetest - icinfo - taskmgr (in dbgchnl.c) - expand - wordpad (one error message that should never appear)
Following programs print correctly to the console - reg - xcopy - winedbg - cmd - regedit (surprise!)
Following programs have commented (or #if 0) out printf(...), which should probably get deleted or converted to TRACE debug logs messages. - progman
I tested behaviour of all listed programs. The big surprise was regedit, which correctly outputs to the console despite of using printf. Probably this is some build option (it uses the msvcrt headers, for example).
If one looks at two programs that get it right, reg and xcopy, one sees the functions reg_printfW and XCOPY_wprintf respectively, that do approximately the same thing: Print a string into a wide char buffer (fixed length in both cases!), and then try WriteConsoleW, if that fails, WideCharToMultiByte and WriteFile(GetStdHandler(STD_OUTPUT_HANDLE),..). This function would have to be cut-and-pasted into the other 10 programs needing it. I don't think this is a good idea. (WCMD_output_asis_len is also a close match)
If the programs are crosscompiled to Windows/msvcrt, output is OK for all of them, because msvcrt's stdio is not based on unix/posix/K&R stdio, but on WriteFile(...)
How to handle this issue?
http://bugs.winehq.org/show_bug.cgi?id=13861
Dan Kegel dank@kegel.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |dank@kegel.com
--- Comment #1 from Dan Kegel dank@kegel.com 2008-06-11 17:46:18 --- A common helper function seems like a good idea...
http://bugs.winehq.org/show_bug.cgi?id=13861
Michael Karcher wine@mkarcher.dialup.fu-berlin.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P3
--- Comment #2 from Michael Karcher wine@mkarcher.dialup.fu-berlin.de 2008-06-16 01:09:20 --- Sorry for the overinflated priority. I assumed P1 to be the *lowest* priority.
http://bugs.winehq.org/show_bug.cgi?id=13861
Jeff Zaroyko jeffz@jeffz.name changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jeffz@jeffz.name
http://bugs.winehq.org/show_bug.cgi?id=13861
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, source
http://bugs.winehq.org/show_bug.cgi?id=13861
André H. nerv@dawncrow.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW AssignedTo|wine-bugs@winehq.org |nerv@dawncrow.de Ever Confirmed|0 |1
--- Comment #3 from André H. nerv@dawncrow.de 2009-08-16 10:53:50 --- Created an attachment (id=23115) --> (http://bugs.winehq.org/attachment.cgi?id=23115) net: build with msvcrt
confirming in wine-1.1.27
to reproduce you can just start the console with: wineconsole cmd and then type net help
If its displayed in wineconsole the bug is fixed for net
attached a patch which shows whats necessary for net to use msvcrt should i send a patch for all to wine-patches?
http://bugs.winehq.org/show_bug.cgi?id=13861
André H. nerv@dawncrow.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch
http://bugs.winehq.org/show_bug.cgi?id=13861
--- Comment #4 from Dan Kegel dank@kegel.com 2009-08-16 12:15:37 --- BTW let's make sure that fixing this doesn't cause problems when running commands outside of wineconsole. e.g. a) $ winepath c:\ > winepath.out should put $WINEPREFIX/dosdevices/c:/ into winepath.out and b) if I ssh into a remote box, with DISPLAY not set, $ winepath c:\ should display $WINEPREFIX/dosdevices/c:/ properly on the terminal.
Wine has a history of screwing this up...
http://bugs.winehq.org/show_bug.cgi?id=13861
--- Comment #5 from André H. nerv@dawncrow.de 2009-09-09 13:17:14 --- (In reply to comment #4)
BTW let's make sure that fixing this doesn't cause problems when running commands outside of wineconsole. e.g.
So AJs comment on it is to fix that in wineconsole
http://bugs.winehq.org/show_bug.cgi?id=13861
André H. nerv@dawncrow.de changed:
What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|nerv@dawncrow.de |wine-bugs@winehq.org
http://bugs.winehq.org/show_bug.cgi?id=13861
François Gouget fgouget@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |fgouget@codeweavers.com Resolution| |WONTFIX
--- Comment #6 from François Gouget fgouget@codeweavers.com 2011-08-26 04:19:21 CDT --- Here is an update on this.
First here are the fixed tools: - cmd - hostname - ipconfig - net - reg - taskkill - winedbg - xcopy
One half fixed tool: - regedit (bug 28192) Mysteriously links with msvcrt. But in wineconsole the usage message appears only after regedit has already quit (i.e. after the wineconsole prompt).
The ones that are not fixed yet: - expand (bug 28187) - icinfo (bug 28188) - uninstaller (bug 28186 and bug 28185) - regsvr32 (bug 28189) - winepath (bug 28190) - winetest (bug 28191)
And some 'cheaters'. As such they probably don't need fixing: - msiexec (brings up a MessageBox) - taskmgr (ignores the command line) - wordpad (no usage, GUI app)
What this shows however is that there should be one bug for each tool: * Because there is no global fix, each tool will need to be fixed one by one. * To simplify tracking which tool is fixed and which is still buggy.
So I created new bugs the the tools that are not fixed yet and indicated the bug numbers above. These new bugs also indicate they were split off from this one and I am now closing this bug as it is now redundant.
http://bugs.winehq.org/show_bug.cgi?id=13861
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #7 from Austin English austinenglish@gmail.com 2011-09-22 13:31:30 CDT --- Closing.
http://bugs.winehq.org/show_bug.cgi?id=13861
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Platform|All |Other OS/Version|All |other
--- Comment #8 from Austin English austinenglish@gmail.com 2012-02-23 15:00:32 CST --- Removing deprecated 'All' Platform/OS.