ctubbsii commented on PR #2037:
URL: https://github.com/apache/zookeeper/pull/2037#issuecomment-1828187021

   > This issue seems back to 2014 where the reason for doing so is "consistent 
with Hadoop's flavor".
   > 
   > I tend to avoid adding this new logic as long as the original 
`ZOOKEEPER_HOME` detected logic is always true: Said from `$0` and depends on 
the folder structure, if it's always the correct ZOOKEEPER_HOME, why do we 
introduce a new envvar that is possibly misspelled?
   
   The idea of a `_HOME` environment is a pretty unreliable convention, and 
tends to cause headaches for downstream packagers/redistributors trying to 
integrate an application into the conventions of the target system. Most Linux 
distros have conventions for where to place specific files... like /usr/bin/ 
for binaries, where /usr can typically be mounted read-only, and /etc for 
config, which typically needs to be mounted with write capability. If an 
application is deployed in such a typical Linux environment, it'd be very 
unusual for a user to be able to completely change how the installed software 
interacts with its own installed binaries by setting some user environment 
variable. Imagine these scripts installed in `/usr/bin/`, but then the user 
sets `ZOOKEEPER_HOME`. Now, you can have a strange situation where the user 
calls `/usr/bin/zkCli.sh`, but that calls 
`/home/somebody/Desktop/zookeeper/bin/zkEnv.sh` because the `ZOOKEEPER_HOME` is 
set, which then sets up a `CLASSPATH` point
 ing back to `/usr/share/zookeeper/zookeeper-*.jar` instead of 
`/home/somebody/Desktop/zookeeper/lib/zookeeper-*.jar`. Now, you have a mix of 
binaries and libraries being used from one installation in the system and 
another installation defined by user config.
   
   It's too confusing, and it's an awful convention. I don't think Hadoop's 
convention is worth following... it's just not very friendly to downstream 
packagers/redistributors/users. I think it's same to assume that however you 
got to a particular installation's binaries, the other binaries from the same 
installation are in the same directory. So, you don't need to redirect towards 
`ZOOKEEPER_HOME` in these... you can just use `$0` to find the current script 
and its sibling scripts from the same installation. Now, if you want to use 
`ZOOKEEPER_HOME` to find the initial installation, that's reasonable. But it's 
not reasonable to use it internally within an installation.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@zookeeper.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to