[PATCH 0/1] MR9946: start: Remove quotes from the path specified by '/d'.
I'm not sure how to write a test case for this bug, as it involves creating a child process and I don't know how to verify if the child process was created correctly. Please test manually: enter `start /d "c:\windows" regedit.exe` in a batch file. It won't work correctly because `start` wraps the directory specified by `/D` with `L"\"\\\""` and `L"\\\"\""`. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9946
From: YeshunYe <yeyeshun@uniontech.com> Signed-off-by: YeshunYe <yeyeshun@uniontech.com> --- programs/start/start.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/programs/start/start.c b/programs/start/start.c index 80f623e4c66..8840d4ab042 100644 --- a/programs/start/start.c +++ b/programs/start/start.c @@ -458,6 +458,18 @@ static void parse_command_line( int argc, WCHAR *argv[] ) usage(); } else opts.sei.lpDirectory = argv[++i]; + + if (opts.sei.lpDirectory[0] == '\"') + { + int len = wcslen(opts.sei.lpDirectory); + /* no need to free since the process will exit shortly */ + WCHAR* lpDirectory = wcsdup(opts.sei.lpDirectory); + if (lpDirectory[len - 1] == '\"') + lpDirectory[len - 1] = 0; + else + WINE_ERR("quotes does not match!\n"); + opts.sei.lpDirectory = lpDirectory + 1; + } } else if (is_option(argv[i], L"/b")) opts.creation_flags &= ~CREATE_NEW_CONSOLE; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9946
a test should be needed for testing, you could try to use (not fully tested): start /B /WAIT /d "foo" cmd /s /c "if /I "%cd%"=="foo" (exit 0) else (exit 1)" (replace foo by a path that exists) and check command return status (it should 0 upon success, and 1 if failure) -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9946#note_127989
participants (3)
-
eric pouech (@epo) -
Yeshun Ye (@yeyeshun) -
YeshunYe