-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
Implement suggested fix from #30606 #33405
Conversation
Pinging @elastic/es-core-infra |
@nogginbox This PR (specifically the 2nd commit) does also have those double-quotes removed. |
@LeeDr really sorry. I did not see that. I somehow copied the code from the first commit only. Thanks for taking the time with me when the problem was PEBKAC. |
@jasontedor I'm not sure what to do with the failures above. Do I retest? In Kibana we comment "Jenkins test this" to run CI again. Is it the same here? |
I have managed to reproduce that as well: using java from a path with spaces and parenthesis
that failure is from elasticsearch-env.bat : 60 fixing this as advised
will let me to fail in elasticsearch.bat:46 (addressed in this PR)
and only then when fixed with the snipped from the PR it will let me start
I will update this PR with the fix I needed in elasticserach-env.bat as well |
@pgomulka Thanks for looking into this. Are the some packaging tests that we can add that fail before these changes, and then pass with the changes that you are suggesting. That is what we should have before pulling this change in, so that we are less likely to continually break in these situations when we do maintenance on these scripts. |
@jasontedor agree, packaging test would be really useful for this. Will look into adding more scenarios |
the elasticsearch.bat and elasticsearch-env.bat won't work if JAVA contains parentheses. This seems to be the limitation of FOR /F IN (command) DO syntax. The JAVA variable present in a command contains a path to a binary to start elasticsearch (with spaces & parens). We can workaround the problem of spaces and parentheses in this path by referring this variable with a CALL command. Note that executing binaries with CALL is an undocumented behaviour (but works) closes #38578 closes #38624 closes #33405 closes #30606
…39712) the elasticsearch.bat and elasticsearch-env.bat won't work if JAVA contains parentheses. This seems to be the limitation of FOR /F IN (command) DO syntax. The JAVA variable present in a command contains a path to a binary to start elasticsearch (with spaces & parens). We can workaround the problem of spaces and parentheses in this path by referring this variable with a CALL command. Note that executing binaries with CALL is an undocumented behaviour (but works) closes elastic#38578 closes elastic#38624 closes elastic#33405 closes elastic#30606
the elasticsearch.bat and elasticsearch-env.bat won't work if JAVA contains parentheses. This seems to be the limitation of FOR /F IN (command) DO syntax. The JAVA variable present in a command contains a path to a binary to start elasticsearch (with spaces & parens). We can workaround the problem of spaces and parentheses in this path by referring this variable with a CALL command. Note that executing binaries with CALL is an undocumented behaviour (but works) closes elastic#38578 closes elastic#38624 closes elastic#33405 closes elastic#30606
the elasticsearch.bat and elasticsearch-env.bat won't work if JAVA contains parentheses. This seems to be the limitation of FOR /F IN (command) DO syntax. The JAVA variable present in a command contains a path to a binary to start elasticsearch (with spaces & parens). We can workaround the problem of spaces and parentheses in this path by referring this variable with a CALL command. Note that executing binaries with CALL is an undocumented behaviour (but works) closes elastic#38578 closes elastic#38624 closes elastic#33405 closes elastic#30606
…40768) the elasticsearch.bat and elasticsearch-env.bat won't work if JAVA contains parentheses. This seems to be the limitation of FOR /F IN (command) DO syntax. The JAVA variable present in a command contains a path to a binary to start elasticsearch (with spaces & parens). We can workaround the problem of spaces and parentheses in this path by referring this variable with a CALL command. Note that executing binaries with CALL is an undocumented behaviour (but works) closes #38578 closes #38624 closes #33405 closes #30606 backports: * Bat scripts to work with JAVA_HOME with parentheses(#39712) * Link to SYSTEM_JAVA_HOME on windows (#40806)
the elasticsearch.bat and elasticsearch-env.bat won't work if JAVA contains parentheses. This seems to be the limitation of FOR /F IN (command) DO syntax. The JAVA variable present in a command contains a path to a binary to start elasticsearch (with spaces & parens). We can workaround the problem of spaces and parentheses in this path by referring this variable with a CALL command. Note that executing binaries with CALL is an undocumented behaviour (but works) closes elastic#38578 closes elastic#38624 closes elastic#33405 closes elastic#30606
Fixes: #30606
While setting up my new Windows 10 Pro laptop I took the default path for installing the Java 10 JRE;
"C:\Program Files (x86)\Common Files\Oracle\Java"
I'm running a Kibana script that downloads and starts the latest elasticsearch snapshot but it kept failing with this error;
ERROR \Common was unexpected at this time.
@Dobatymo and @lashchev suggested variations on a fix in #30606. I applied the changes exactly as Lashchev suggested here #30606 (comment)
It resolved this problem for me.
NOTE: In my case, I had the JRE installed to that default path, and although I had the jdk 10 installed, I did not have JAVA_HOME set, so it was using the java executable from the JRE that was in my path var.
If I set my JAVA_HOME variable (my jdk path has no spaces or parenthesis) I can start elasticsearch without this fix. But we should fix this problem since it would a common case for Windows users to download the JRE, take the default installation path, and then try to start Elasticsearch.