http://bugs.winehq.org/show_bug.cgi?id=10192
Summary: wcmd: command piping broken Product: Wine Version: 0.9.48. Platform: PC-x86-64 OS/Version: Linux Status: UNCONFIRMED Severity: enhancement Priority: P2 Component: wine-console AssignedTo: wine-bugs@winehq.org ReportedBy: mpartap@gmx.net
Hi there, still trying to get KDE4/win32 compiled under WINE... the python glitches went away by creating a fresh .wine directory, however another problem came up: piping is broken in wineconsole. F.e., dir | more results in this:
C:\kderoot\emerge\bin>dir | more trace:cmd:WCMD_DumpCommands Parsed line: trace:cmd:WCMD_DumpCommands L"0012F6E8 N 00 00000000 dir more Redir:" trace:cmd:WCMD_process_commands Executing command: 'L"dir more"' trace:cmd:WCMD_execute command on entry:L"dir more" (0x33f5d0), with '(null)'='(null)' trace:cmd:WCMD_execute Command: 'L"dir more"' trace:cmd:WCMD_execute param1: L"more", param2: L"" trace:cmd:WCMD_directory Found parm 'L"more"' trace:cmd:WCMD_directory Using location 'L"C:\kderoot\emerge\bin\more"' trace:cmd:WCMD_directory Using path 'L"C:\kderoot\emerge\bin\more"' trace:cmd:WCMD_directory Path Parts: drive: 'L"C:"' dir: 'L"\kderoot\emerge\bin\"' name: 'L"more"' ext:'L""' trace:cmd:WCMD_directory Writing volume for 'C:' Volume in drive C is Volume Serial Number is 0000-0000
trace:cmd:WCMD_list_directory Looking for matches to 'L"C:\kderoot\emerge\bin\more"' Directory of C:\kderoot\emerge\bin
File not found
trace:cmd:WCMD_dir_trailer Writing trailer for 'L"C:\"' gave 1(87) C:\kderoot\emerge\bin>
so obviously, the '|' is lost somewhere and 'dir more' is what gets executed... output redirection into a file with '>' works as expected. I had a look at wcmdmain.c but I could only narrow down the problem to be somewhere within WCMD_ReadAndParseLine and WCMD_pipe so any further investigation would be appreciated.
http://bugs.winehq.org/show_bug.cgi?id=10192
Lei Zhang thestig@google.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1
--- Comment #1 from Lei Zhang thestig@google.com 2007-10-28 13:14:45 --- confirmed, dir | more doesn't work for me either.
http://bugs.winehq.org/show_bug.cgi?id=10192
Jason Edmeades us@edmeades.me.uk changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |wine-bugs@winehq.org, | |us@edmeades.me.uk AssignedTo|wine-bugs@winehq.org |us@edmeades.me.uk
--- Comment #2 from Jason Edmeades us@edmeades.me.uk 2007-10-28 14:40:57 --- That'll probably be my fault :-( I'll take a look (any wcmd issues an be assigned to me for now)
http://bugs.winehq.org/show_bug.cgi?id=10192
--- Comment #3 from Marcel Partap mpartap@gmx.net 2007-11-15 07:12:38 --- hey Jason I really didn't quite understand how the pipe character is treated so I had no success in fixing (getting segfaults worked perfectly though ;).. this blocks testing the KDE4 compile under WINE so I'd be willing to look at it again if you can point me into the right direction...
http://bugs.winehq.org/show_bug.cgi?id=10192
Jason Edmeades us@edmeades.me.uk changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED
--- Comment #4 from Jason Edmeades us@edmeades.me.uk 2007-11-18 14:04:48 --- Sorry - due to a bereavement followed by a vacation, I havent got to it yet.. Back now so hopefully soon (give me a few days to catch up).
Unfortunately its not easy to fix, but to do it properly will remove part of a hack which isnt nice anyway: - Originally, the commandline was null terminated at the first >. < or | character, and everything before it was the command, and everything after it was then special cased into pipe command or filename. This was very wrong in lots of respects and failed to handle most cases other than the one it worked for. The pipe support is also hacked in (wcmd_pipe) whereas it really should be handleable by the mainline code.
- Now, when parsing a line we split the input into a command string and redirects. Currently, the pipe is put into the redirects which is where it all goes badly wrong (The wcmd_pipe routine assumes the command string contains the command whereas it no longer does)
- The 'right' fix is to extend the support for && to also support | (and || plus & which also work and are unsupported) - ie split the pipe bit of the input into a new command chained off the previous one, with flags saying what its used for
This will also resolve problems like "mycommand 2>error.log | mypipe 2>error2.log" which currently fail badly
Out of interest whats the exact command which fails in the kde4 stuff - I'll ensure I use it as a testcase.
http://bugs.winehq.org/show_bug.cgi?id=10192
--- Comment #5 from Marcel Partap mpartap@gmx.net 2007-11-21 03:09:09 --- Hey Jason, well from what I remember the failure occured in file http://websvn.kde.org/*checkout*/trunk/kdesupport/kdewin32/emerge/bin/utils.... on this line: command = "type %s | sed %s > %s" % ( backup, sedcommand, file ) but that should work if cat somethign|more starts working again.. thx for investigating.
http://bugs.winehq.org/show_bug.cgi?id=10192
--- Comment #6 from Jason Edmeades us@edmeades.me.uk 2007-11-25 16:10:59 --- Created an attachment (id=9343) --> (http://bugs.winehq.org/attachment.cgi?id=9343) Test patch to improve pipes
Any chance of testing this patch and feeding back results please?
Thanks - sorry for the delay and the regression. Fix is nasty but really needed...
http://bugs.winehq.org/show_bug.cgi?id=10192
--- Comment #7 from Marcel Partap mpartap@gmx.net 2007-12-24 08:25:26 --- dear jason, just wanted to write here that patch seems to work, sorry for late reply.. now I'm running into differnt probs building KDE but can't look at it this year no more. happy holidays and a fun new year ;)
http://bugs.winehq.org/show_bug.cgi?id=10192
James Hawkins truiken@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED
--- Comment #8 from James Hawkins truiken@gmail.com 2008-01-07 01:08:24 --- Jason's patches should have fixed this.
http://bugs.winehq.org/show_bug.cgi?id=10192
James Hawkins truiken@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|_obsolete_console |programs
http://bugs.winehq.org/show_bug.cgi?id=10192
Jason Edmeades us@edmeades.me.uk changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED |
--- Comment #9 from Jason Edmeades us@edmeades.me.uk 2008-01-08 17:34:52 --- Just realized I never sent this to wine-patches... I should be back working on wine really soon (week or so) so will send it then, sorry about that
http://bugs.winehq.org/show_bug.cgi?id=10192
--- Comment #10 from Jason Edmeades us@edmeades.me.uk 2008-03-03 17:18:44 --- Better late than never - patch sent in today
http://bugs.winehq.org/show_bug.cgi?id=10192
--- Comment #11 from Jason Edmeades us@edmeades.me.uk 2008-03-06 14:15:23 --- fixed in git
http://bugs.winehq.org/show_bug.cgi?id=10192
Lei Zhang thestig@google.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution| |FIXED
--- Comment #12 from Lei Zhang thestig@google.com 2008-03-06 15:30:30 --- Patch is here: http://www.winehq.org/pipermail/wine-cvs/2008-March/040983.html
http://bugs.winehq.org/show_bug.cgi?id=10192
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #13 from Alexandre Julliard julliard@winehq.org 2008-03-07 11:28:30 --- Closing bugs fixed in 0.9.57.
http://bugs.winehq.org/show_bug.cgi?id=10192
Dan Kegel dank@kegel.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|programs |cmd