[
https://issues.apache.org/jira/browse/HDDS-1642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16856140#comment-16856140
]
Eric Yang commented on HDDS-1642:
---------------------------------
Mature software uses two techniques to avoid compute relative path. User
defined environment variable, i.e JAVA_HOME is a good example. The second
approach is to lookup configuration in series of predefined path to discover
software installed location. For example, mvn script looks for /etc/mavenrc
then ~/.mavenrc and other deciding factors to compute MAVEN_HOME. Every
script or binary within the binary package will compute location base on
[software]_HOME directory variable. The same technique can apply to Ozone CLI
scripts to make path resolution consistent and only happen in one place during
the bootstrap stage.
> Avoid shell references relative to the current script path
> ----------------------------------------------------------
>
> Key: HDDS-1642
> URL: https://issues.apache.org/jira/browse/HDDS-1642
> Project: Hadoop Distributed Data Store
> Issue Type: Bug
> Reporter: Eric Yang
> Priority: Minor
>
> This is based on the review comment from [~eyang]:
> bq. You might need pwd -P to resolve symlinks. I don't recommend to use
> script location to make decision of where binaries are supposed to be because
> someone else can make newbie mistake and refactor your script to invalid the
> original coding intend. See this blog to explain the right way to get the
> directory of a bash script. This is the reason that I used OZONE_HOME as base
> reference frequently.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]