-
Notifications
You must be signed in to change notification settings - Fork 28.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-6435] spark-shell --jars option does not add all jars to classpath #5227
Changes from 4 commits
04f4291
2a332e5
0d4dc41
1fee420
60789a7
ac55787
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -243,7 +243,7 @@ static String quoteForBatchScript(String arg) { | |
boolean needsQuotes = false; | ||
for (int i = 0; i < arg.length(); i++) { | ||
int c = arg.codePointAt(i); | ||
if (Character.isWhitespace(c) || c == '"' || c == '=') { | ||
if (Character.isWhitespace(c) || c == '"' || c == '=' || c == ',' || c == ';') { | ||
needsQuotes = true; | ||
break; | ||
} | ||
|
@@ -260,15 +260,14 @@ static String quoteForBatchScript(String arg) { | |
quoted.append('"'); | ||
break; | ||
|
||
case '=': | ||
quoted.append('^'); | ||
break; | ||
|
||
default: | ||
break; | ||
} | ||
quoted.appendCodePoint(cp); | ||
} | ||
if (arg.codePointAt(arg.length() - 1) == '\\') { | ||
quoted.append("\\"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is indented too far. Why would a backslash need escaping only in the final position? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In batch, backslash There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, I assumed you would escape all backslashes if they are the escape character. Is that not necessary? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Backslash is escape character only when followed by There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, so it's not a general escape character, got it. |
||
} | ||
quoted.append("\""); | ||
return quoted.toString(); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,12 +101,9 @@ public static void main(String[] argsArray) throws Exception { | |
* The method quotes all arguments so that spaces are handled as expected. Quotes within arguments | ||
* are "double quoted" (which is batch for escaping a quote). This page has more details about | ||
* quoting and other batch script fun stuff: http://ss64.com/nt/syntax-esc.html | ||
* | ||
* The command is executed using "cmd /c" and formatted in single line, since that's the | ||
* easiest way to consume this from a batch script (see spark-class2.cmd). | ||
*/ | ||
private static String prepareWindowsCommand(List<String> cmd, Map<String, String> childEnv) { | ||
StringBuilder cmdline = new StringBuilder("cmd /c \""); | ||
StringBuilder cmdline = new StringBuilder(""); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume you're sure about this, but we definitely don't always need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why we are using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK I trust your judgment on this. This is confined to Windows support and I believe you're closest to this code. Note that you don't need the argument |
||
for (Map.Entry<String, String> e : childEnv.entrySet()) { | ||
cmdline.append(String.format("set %s=%s", e.getKey(), e.getValue())); | ||
cmdline.append(" && "); | ||
|
@@ -115,7 +112,6 @@ private static String prepareWindowsCommand(List<String> cmd, Map<String, String | |
cmdline.append(quoteForBatchScript(arg)); | ||
cmdline.append(" "); | ||
} | ||
cmdline.append("\""); | ||
return cmdline.toString(); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you run SparkLauncherSuite on Windows? I added this specifically to fix an issue with that path (see 92a9cfb).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've run
SparkLauncherSuite
on Windows and it's OK.If double-quotation is parsed properly,
=
in double-quotation is not need to be escaped.