GitHub user minixalpha opened a pull request: https://github.com/apache/spark/pull/19090
[SPARK-21877][DEPLOY, WINDOWS] Handle quotes in Windows command scripts ## What changes were proposed in this pull request? All the windows command scripts can not handle quotes in parameter. Run a windows command shell with parameter which has quotes can reproduce the bug: ``` C:\Users\meng\software\spark-2.2.0-bin-hadoop2.7> bin\spark-shell --driver-java-options " -Dfile.encoding=utf-8 " 'C:\Users\meng\software\spark-2.2.0-bin-hadoop2.7\bin\spark-shell2.cmd" --driver-java-options "' is not recognized as an internal or external command, operable program or batch file. ``` Windows recognize "--driver-java-options" as part of the command. All the Windows command script has the following code have the bug. ``` cmd /V /E /C "<other command>" %* ``` We should quote command and parameters like ``` cmd /V /E /C ""<other command>" %*" ``` We can verify it by the following demo: ``` C:\Users\meng\program\demo>cat a.cmd @echo off cmd /V /E /C "b.cmd" %* C:\Users\meng\program\demo>cat b.cmd @echo off echo %* C:\Users\meng\program\demo>cat c.cmd @echo off cmd /V /E /C ""b.cmd" %*" C:\Users\meng\program\demo>a.cmd "123" 'b.cmd" "123' is not recognized as an internal or external command, operable program or batch file. C:\Users\meng\program\demo>c.cmd "123" "123" ``` ## How was this patch tested? Test manually on Windows 10. (Please explain how this patch was tested. E.g. unit tests, integration tests, manual tests) (If this patch involves UI changes, please attach a screenshot; otherwise, remove this) Please review http://spark.apache.org/contributing.html before opening a pull request. You can merge this pull request into a Git repository by running: $ git pull https://github.com/minixalpha/spark master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/19090.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #19090 ---- commit 26fc75670750b4710a2e0d97642ec1b52d51ffbb Author: minixalpha <xkzal...@gmail.com> Date: 2017-08-31T00:31:39Z handle quotes in Windows command scripts ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org