-
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
Conversation
…path Modified to accept multiple jars in spark-shell.cmd.
Test build #29297 has finished for PR 5227 at commit
|
I tend to trust your judgment on modifying these Windows scripts, especially if you've verified that this works where it did not before. CC @nishkamravi2 and @vanzin since this will touch the scripts also being modified in #5085 |
I think the real problem here is that So I think the correct fix would be to change |
Ah, and even though jenkins doesn't run unit tests on Windows, it would be nice to update |
Hi @tsudukim , are you planning on trying my suggestion? Otherwise I can make the change and test it. |
@vanzin I'm not sure I have got your suggestion right, but as I wrote in JIRA, I think this is not the Java side problem. |
Java application means the launcher |
Conflicts: bin/spark-class2.cmd
- added random string to the temporary filename - double-quotation followed by `cmd /c` did not worked properly - no need to escape `=` by `^` - if double-quoted string ended with `\` like classpath, the last `\` is parsed as the escape charactor and the closing `"` didn't work properly
Ah @vanzin, I didn't understand your suggestion. When we execute Two job at the same time is surely a problem, so added random string to the filename to reduce the probability this problem occurs. I know it's better to solve this problem without using temporary file if possible, but I have no idea now. If you've got any suggestion, please let me know. |
Test build #29590 has finished for PR 5227 at commit
|
oops, forgot to include fixed test code. |
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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
In batch, backslash \
followed by double-quotation "
is parsed as a escape charactor.
For example, \"
means "
itself.
We face a problem in this case:
java.exe -cp "C:\path\to\directory\" ...
The closing "
doesn't work properly, so we should escape only the last \
.
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.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Backslash is escape character only when followed by "
. I assumed it's the only case when the string ends with backslash.
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.
OK, so it's not a general escape character, got it.
Test build #29599 has finished for PR 5227 at commit
|
@@ -260,15 +260,14 @@ static String quoteForBatchScript(String arg) { | |||
quoted.append('"'); | |||
break; | |||
|
|||
case '=': |
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.
I tried to figure out a solution that didn't involve a temp file, but failed. Guess I'll just delegate - change looks fine except for the one comment I left about testing. |
@tsudukim back to you regarding the test case. I'd like to get this in one way or the other since it's an important fix for Windows. |
@tsudukim Ping? I think this still has an outstanding question from Marcelo above that should be addressed. |
Ah, sorry to be late... I didn't have time to struggle with it. I'll do it this week. |
Is this one still active? I'd like to figure out whether this is stalled or might proceed. |
…/SPARK-6435-2 Conflicts: bin/spark-class2.cmd
I was checking about the |
The problem I mentioned was that the spark-shell.cmd which is called by So I assume all issue is now cleared up. Sorry for my late response. |
Test build #719 has finished for PR 5227 at commit
|
bq. limitation of Windows batch that the one command line must be shorter than 8192 characters This may be fixable is it's something we really care about, but not related to this change. Given that the test passes, LGTM (based on my previous comments - didn't look at the changes again). |
Test build #31039 has started for PR 5227 at commit |
…path Modified to accept double-quotated args properly in spark-shell.cmd. Author: Masayoshi TSUZUKI <tsudukim@oss.nttdata.co.jp> Closes apache#5227 from tsudukim/feature/SPARK-6435-2 and squashes the following commits: ac55787 [Masayoshi TSUZUKI] removed unnecessary argument. 60789a7 [Masayoshi TSUZUKI] Merge branch 'master' of https://github.com/apache/spark into feature/SPARK-6435-2 1fee420 [Masayoshi TSUZUKI] fixed test code for escaping '='. 0d4dc41 [Masayoshi TSUZUKI] - escaped comman and semicolon in CommandBuilderUtils.java - added random string to the temporary filename - double-quotation followed by `cmd /c` did not worked properly - no need to escape `=` by `^` - if double-quoted string ended with `\` like classpath, the last `\` is parsed as the escape charactor and the closing `"` didn't work properly 2a332e5 [Masayoshi TSUZUKI] Merge branch 'master' into feature/SPARK-6435-2 04f4291 [Masayoshi TSUZUKI] [SPARK-6435] spark-shell --jars option does not add all jars to classpath
…path Modified to accept double-quotated args properly in spark-shell.cmd. Author: Masayoshi TSUZUKI <tsudukim@oss.nttdata.co.jp> Closes apache#5227 from tsudukim/feature/SPARK-6435-2 and squashes the following commits: ac55787 [Masayoshi TSUZUKI] removed unnecessary argument. 60789a7 [Masayoshi TSUZUKI] Merge branch 'master' of https://github.com/apache/spark into feature/SPARK-6435-2 1fee420 [Masayoshi TSUZUKI] fixed test code for escaping '='. 0d4dc41 [Masayoshi TSUZUKI] - escaped comman and semicolon in CommandBuilderUtils.java - added random string to the temporary filename - double-quotation followed by `cmd /c` did not worked properly - no need to escape `=` by `^` - if double-quoted string ended with `\` like classpath, the last `\` is parsed as the escape charactor and the closing `"` didn't work properly 2a332e5 [Masayoshi TSUZUKI] Merge branch 'master' into feature/SPARK-6435-2 04f4291 [Masayoshi TSUZUKI] [SPARK-6435] spark-shell --jars option does not add all jars to classpath
The same issue happens to the Mac OS. If multiple jar paths were specified, only the first one would be visible. Don't know if this issue was created and resolved or not. |
Modified to accept double-quotated args properly in spark-shell.cmd.