mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-22 21:32:31 +00:00
Improve execve() path argument munging
Munging of paths passed inside the system() interpreter command is no longer supported. You have to pass your paths to posix_spawn() or the execve() family of functions if you want them to be munged. The first three characters must match `^/[a-z]/` in which case, it'll be turned into a DOS-style drive path with backslashes.
This commit is contained in:
parent
529cb4817c
commit
32b97f2d25
5 changed files with 88 additions and 78 deletions
|
@ -74,30 +74,14 @@ TEST(mkntcmdline, testUnicode) {
|
|||
cmdline);
|
||||
}
|
||||
|
||||
TEST(mkntcmdline, fixAsBestAsWeCanForNow1) {
|
||||
TEST(mkntcmdline, fixit) {
|
||||
char *argv1[] = {
|
||||
"/C/WINDOWS/system32/cmd.exe",
|
||||
"/C",
|
||||
"more <\"/C/Users/jart/AppData/Local/Temp/tmplquaa_d6\"",
|
||||
"/C/Program Files/doom/doom.exe",
|
||||
"--version",
|
||||
NULL,
|
||||
};
|
||||
EXPECT_NE(-1, mkntcmdline(cmdline, argv1));
|
||||
EXPECT_STREQ(u"C:\\WINDOWS\\system32\\cmd.exe /C \"more <"
|
||||
u"\"\"\"C:/Users/jart/AppData/Local/Temp/tmplquaa_d6\"\"\"\"",
|
||||
cmdline);
|
||||
}
|
||||
|
||||
TEST(mkntcmdline, fixAsBestAsWeCanForNow2) {
|
||||
char *argv1[] = {
|
||||
"/C/WINDOWS/system32/cmd.exe",
|
||||
"/C",
|
||||
"less /C/Users/jart/AppData/Local/Temp/tmplquaa_d6",
|
||||
NULL,
|
||||
};
|
||||
EXPECT_NE(-1, mkntcmdline(cmdline, argv1));
|
||||
EXPECT_STREQ(u"C:\\WINDOWS\\system32\\cmd.exe /C \"less "
|
||||
u"C:/Users/jart/AppData/Local/Temp/tmplquaa_d6\"",
|
||||
cmdline);
|
||||
EXPECT_STREQ(u"\"C:\\Program Files\\doom\\doom.exe\" --version", cmdline);
|
||||
}
|
||||
|
||||
TEST(mkntcmdline, testWut) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue