提交 4ae7bcd0 编写于 作者: K ksrini

8007333: [launcher] removes multiple back slashes

Reviewed-by: alanb, akhil
上级 9147d14d
......@@ -128,7 +128,9 @@ static char* next_arg(char* cmdline, char* arg, jboolean* wildcard) {
*wildcard = JNI_TRUE;
}
if (prev == '\\') {
*dest++ = prev;
for (i = 0 ; i < slashes ; i++) {
*dest++ = prev;
}
}
*dest++ = ch;
break;
......@@ -184,7 +186,7 @@ void JLI_CmdToArgs(char* cmdline) {
argv = (StdArg*) JLI_MemRealloc(argv, (nargs+1) * sizeof(StdArg));
argv[nargs].arg = JLI_StringDup(arg);
argv[nargs].has_wildcard = wildcard;
*arg = NULL;
nargs++;
} while (src != NULL);
......@@ -602,6 +604,14 @@ int main(int argc, char* argv[]) {
v->add("d", FALSE);
vectors[i++] = v;
v= new Vector(argv[0], "\\\\?");
v->add("\\\\?", TRUE);
vectors[i++] = v;
v= new Vector(argv[0], "\\\\*");
v->add("\\\\*", TRUE);
vectors[i++] = v;
dotest(vectors);
printf("All tests pass [%d]\n", i);
doexit(0);
......
......@@ -24,7 +24,7 @@
/**
* @test
* @bug 5030233 6214916 6356475 6571029 6684582 6742159 4459600 6758881 6753938
* 6894719 6968053 7151434 7146424
* 6894719 6968053 7151434 7146424 8007333
* @summary Argument parsing validation.
* @compile -XDignore.symbol.file Arrrghs.java
* @run main/othervm Arrrghs
......@@ -310,6 +310,20 @@ public class Arrrghs extends TestHelper {
checkArgumentParsing("..\\..\\", "..\\..\\");
checkArgumentParsing("../../", "../../");
checkArgumentParsing("a b\\ c", "a", "b\\", "c");
// 2 back-slashes
checkArgumentParsing("\\\\?", "\\\\?");
// 3 back-slashes
checkArgumentParsing("\\\\\\?", "\\\\\\?");
// 4 back-slashes
checkArgumentParsing("\\\\\\\\?", "\\\\\\\\?");
// 5 back-slashes
checkArgumentParsing("\\\\\\\\\\?", "\\\\\\\\\\?");
// 6 back-slashes
checkArgumentParsing("\\\\\\\\\\\\?", "\\\\\\\\\\\\?");
// more treatment of mixed slashes
checkArgumentParsing("f1/ f3\\ f4/", "f1/", "f3\\", "f4/");
checkArgumentParsing("f1/ f2\' ' f3/ f4/", "f1/", "f2\'", "'", "f3/", "f4/");
}
private void initEmptyDir(File emptyDir) throws IOException {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册