Skip to content
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

CLI tools in linux only work from within $ES_HOME #40889

Closed
jkakavas opened this issue Apr 5, 2019 · 2 comments · Fixed by #40890
Closed

CLI tools in linux only work from within $ES_HOME #40889

jkakavas opened this issue Apr 5, 2019 · 2 comments · Fixed by #40890
Labels
blocker >bug :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts Team:Delivery Meta label for Delivery team v7.0.0-rc2

Comments

@jkakavas
Copy link
Member

jkakavas commented Apr 5, 2019

In https://github.com/elastic/elasticsearch/blob/master/distribution/src/bin/elasticsearch-cli,

when we

source "`dirname "$0"`"/elasticsearch-env

we cd in $ES_HOME changing the pwd. However, the dirname commands in the following

for additional_source in "${additional_sources[@]}"
do
  source "`dirname "$0"`"/$additional_source
done

will have an output that is always relevant to the current dir from where the user ran the cli command.

The combination of these two mean, that the source command will try to source a file, the path of which will be the concatenation of $ES_HOME and the dir from where the user ran the cli command. This will only work when the user runs the command from $ES_HOME. Example output from @pheyos who raised this:

robert@elastic-ro:~/es_versions/700_bc1/elasticsearch-7.0.0/bin$ ./elasticsearch-setup-passwords interactive
./elasticsearch-cli: line 10: ./x-pack-env: No such file or directory

./elasticsearch-cli: line 10: ./x-pack-env: No such file or directory is because the pwd at that time is $ES_HOME and not $ES_HOME/bin

@DaveCTurner
Copy link
Contributor

Sounds related to #39937

jkakavas added a commit to jkakavas/elasticsearch that referenced this issue Apr 5, 2019
Since we only source additional sources from the same dir as our
cli scripts, resolve the path relevant to $ES_HOME

Resolves: elastic#40889
@jkakavas jkakavas added blocker :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts labels Apr 5, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@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
blocker >bug :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts Team:Delivery Meta label for Delivery team v7.0.0-rc2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants