Skip to content

fix #38578 env bat quoting issue #38624

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

Closed
wants to merge 1 commit into from

Conversation

Mpdreamz
Copy link
Member

@Mpdreamz Mpdreamz commented Feb 8, 2019

When %JAVA% gets inferred from %PATH% trying to resolve %ES_TMPDIR% failed.

If %JAVA_HOME% was set explicitly this did not cause an error.

When %JAVA% gets inferred from %PATH% trying to resolve %ES_TMPDIR% failed.

If %JAVA_HOME% was set explicitly this did not cause an error.
@matriv matriv added the :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts label Feb 11, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@pgomulka pgomulka self-requested a review February 11, 2019 08:57
@pgomulka
Copy link
Contributor

this should be fixed by #33405
(will look into this)

@Mpdreamz
Copy link
Member Author

The fix with CALL feels out of place since CALL is mostly used to call into other bat files. CALL also slightly changes the escaping rules in the called command (e.g the escaped pipes).

A fix is a fix though, happy either way 👍

@pgomulka
Copy link
Contributor

@Mpdreamz indeed this is undocumented behaviour of CALL to start a program
https://en.wikibooks.org/wiki/Windows_Batch_Scripting#CALL

but as per comment looks to be the safest approach

@Mpdreamz
Copy link
Member Author

Ahh nice find! Closing this in favor of #33405

@Mpdreamz Mpdreamz closed this Feb 26, 2019
pgomulka added a commit that referenced this pull request Apr 2, 2019
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
pgomulka added a commit to pgomulka/elasticsearch that referenced this pull request Apr 3, 2019
…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
pgomulka added a commit to pgomulka/elasticsearch that referenced this pull request Apr 4, 2019
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
pgomulka added a commit to pgomulka/elasticsearch that referenced this pull request Apr 4, 2019
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
pgomulka added a commit that referenced this pull request Apr 5, 2019
…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)
gurkankaymak pushed a commit to gurkankaymak/elasticsearch that referenced this pull request May 27, 2019
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
@mark-vieira mark-vieira added the Team:Delivery Meta label for Delivery team label Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts Team:Delivery Meta label for Delivery team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants