Skip to content

Fix bat scripts to work with JAVA_HOME containing special characters #38965

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

Conversation

pgomulka
Copy link
Contributor

@pgomulka pgomulka commented Feb 15, 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 & parans). 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 pgomulka added the WIP label Feb 15, 2019
@pgomulka pgomulka self-assigned this Feb 15, 2019
@pgomulka pgomulka added :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts and removed WIP labels Feb 15, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@pgomulka
Copy link
Contributor Author

ok to test

@pgomulka pgomulka added the WIP label Feb 15, 2019
@csetzkorn
Copy link

This:

bin\elasticsearch-plugin install file:///C:/bla/ingest-attachment-6.6.0.zip

still throws an error:

\Common was unexpected at this time.

@pgomulka
Copy link
Contributor Author

pgomulka commented Feb 26, 2019

@csetzkorn thank you for this - will indeed increase the scope of this PR to include fixes to all windows bat scripts using to JAVA_HOME with '(' or ' '

@pgomulka
Copy link
Contributor Author

@csetzkorn can you please confirm that you had the failure you mentioned after applying the patch from this PR?

@pgomulka pgomulka added v7.2.0 and removed WIP labels Feb 26, 2019
@pgomulka
Copy link
Contributor Author

@elasticmachine run elasticsearch-ci/packaging

@pgomulka pgomulka requested a review from rjernst March 1, 2019 12:19
@pgomulka pgomulka changed the base branch from master to 6.7 March 5, 2019 16:47
@pgomulka pgomulka changed the base branch from 6.7 to master March 5, 2019 16:52
@pgomulka pgomulka force-pushed the feature/windows_startup_scripts branch from e3d136f to cc33dc3 Compare March 5, 2019 16:57
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 & parans). 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)
@pgomulka pgomulka force-pushed the feature/windows_startup_scripts branch from cc33dc3 to 14cd39f Compare March 5, 2019 16:57
@pgomulka pgomulka changed the base branch from master to 6.7 March 5, 2019 16:57
@pgomulka
Copy link
Contributor Author

pgomulka commented Mar 5, 2019

closing as cannot resolve the conflicts after the base change (seems to be a github bug)

@pgomulka pgomulka closed this Mar 5, 2019
@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