I noticed tonight while looking for a different problem that wcmd doesn't handle batch file lines consisting of an external command with options but no space between the commandline and the option, e.g. start/wait foo.exe In this case it does not find start.exe. Win98 does find start.exe in this case, and wcmd clearly should, too.
I had a quick look at wcmdmain.c, and did the obvious hack
--- wcmdmain.c 5 Mar 2003 02:49:04 -0000 1.26 +++ wcmdmain.c 9 Apr 2003 06:05:40 -0000 @@ -558,7 +560,7 @@ int p = 0; case '\0': return; default: - while ((*s != '\0') && (*s != ' ')) { + while ((*s != '\0') && (*s != ' ') && (*s != '/')) { if (p == 0) *p1++ = *s++; else if (p == 1) *p2++ = *s++; else s++;
It then realized that /wait was a qualifier, and passed the right thing to CreateProcess:
F:>start/wait xx.exe trace:exec:FindExecutableA File start, Dir - trace:exec:SHELL_FindExecutable start trace:exec:SHELL_FindExecutable SearchPathA returned non-zero trace:exec:SHELL_FindExecutable xlpFile=F:\start.exe,extension=.exe trace:exec:SHELL_FindExecutable .exe file trace:exec:SHELL_FindExecutable found F:\start.exe trace:exec:FindExecutableA returning F:\start.exe trace:process:CreateProcessA app (null) cmdline "start/wait xx.exe"
but CreateProcess seems to have screwed up handling the /wait parameter:
trace:process:CreateProcessA starting "F:\start.exe" as Windows binary trace:process:PROCESS_InitWine starting process name="F:\start.exe" file=0x4 argv[0]="start/wait"
and that's the last we hear of /wait. This all works fine if we put a space before the /, in which case the log looks like:
trace:process:CreateProcessA app (null) cmdline "start /wait xx.exe" trace:process:CreateProcessA starting "F:\start.exe" as Windows binary trace:process:PROCESS_InitWine starting process name="F:\start.exe" file=0x4 argv[0]="start"
Hrmph. Guess I should add a print for argv[1] in PROCESS_InitWine.
Or leave this to somebody who understands wcmd better than me :-) - Dan
Is this really a good behaviour ? I would consider allowing this a bug in Win98 parser. What about 'ls-l' in Unix ?
--- Dan Kegel dank@kegel.com a écrit :
I noticed tonight while looking for a different problem that wcmd doesn't handle batch file lines consisting of an external command with options but no space between the commandline and the option, e.g. start/wait foo.exe In this case it does not find start.exe. Win98 does find start.exe in this case, and wcmd clearly should, too.
===== Sylvain Petreolle (spetreolle at users dot sourceforge dot net) ICQ #170597259 No more War !
"What if tomorrow the War could be over ?" Morpheus, in "Reloaded".
For the Law of Oil and Fire, Im an European that lives in France. For all my Brothers and friends, Im a human living on Earth.
___________________________________________________________ Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français ! Yahoo! Mail : http://fr.mail.yahoo.com
"Sylvain" == Sylvain Petreolle spetreolle@yahoo.fr writes:
Sylvain> Is this really a good behaviour ? I would consider allowing Sylvain> this a bug in Win98 parser. What about 'ls-l' in Unix ?
"dir/w" works the same as "dir /w" even in the Command Shel from NT4.
Bye
"Dan Kegel" dank@kegel.com wrote:
I noticed tonight while looking for a different problem that wcmd doesn't handle batch file lines consisting of an external command with options but no space between the commandline and the option, e.g. start/wait foo.exe In this case it does not find start.exe. Win98 does find start.exe in this case, and wcmd clearly should, too.
I think that actually it's a fallback behaviour if "start/wait[.exe|.com|.bat]" application is not found. Can you confirm or disprove this my statement?
Dmitry Timoshkov wrote:
wcmd doesn't handle batch file lines consisting of an external command with options but no space between the commandline and the option, e.g. start/wait foo.exe In this case it does not find start.exe. Win98 does find start.exe in this case, and wcmd clearly should, too.
I think that actually it's a fallback behaviour if "start/wait[.exe|.com|.bat]" application is not found. Can you confirm or disprove this my statement?
I created a directory 'start' and placed in it 'wait.bat', then executed two lines from the command shell: start\wait notepad.exe ran the batch file, but start/wait notepad.exe ran notepad.exe synchronously.
Now I need to do the same with CreateProcess to see what happens; that will tell us whether we need to fix just wcmd, or also the system calls. - Dan
On WinMe, it looks like start/wait notepad.exe invokes start with the /wait option, but in Wine, it invokes start\wait.exe.
As far as I can tell, Wine's CreateProcess is exactly correct with respect to this issue and WinMe. The problem is in wcmd. wcmd's code is messy, the fix is probably nontrivial.
A minor complication: in WinXP, start is now built into wcmd instead of being standalone as in WinMe. As it happens, doing this would fix the present problem (i.e. start/wait not working) accidentally. Might be less painful than the real fix.
Who's the wcmd maven around here? - Dan