You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by mo...@apache.org on 2017/04/23 02:21:54 UTC

zeppelin git commit: [ZEPPELIN-2375]: Avoid modification of CLASSPATH variable.

Repository: zeppelin
Updated Branches:
  refs/heads/master bc1b4be8c -> a3c78a4f4


[ZEPPELIN-2375]: Avoid modification of CLASSPATH variable.

The script previously modified the CLASSPATH variable. This may lead to
an undesired side effect, where the zeppelin server classpath is
exported to the zeppelin interpreter classpath, see JIRA issue
ZEPPELIN-2375 for details. Instead of modifying classpath we now work
the other way around and set ZEPPELIN_CLASSPATH or
ZEPPELIN_INT_CLASSPATH to include CLASSPATH and then use
ZEPPELIN_CLASSPATH or ZEPPELIN_INT_CLASSPATH in the corresponding exec
(runner), respectively.

See also https://issues.apache.org/jira/browse/ZEPPELIN-2375

### What is this PR for?

Fixing issue https://issues.apache.org/jira/browse/ZEPPELIN-2375

### What type of PR is it?

Bug Fix

### Todos

### What is the Jira issue?

* https://issues.apache.org/jira/browse/ZEPPELIN-2375

### How should this be tested?

Without this fix, the following fails on macOS Sierra (OS X):

1.  Open bash, set CLASSPATH to empty string and export it using `export CLASSPATH=`, then start zeppelin via `./bin/zepplin.sh`

2. Create and run a notebook with the md interpreter.

3. Results in an exception.

4. Stop zeppelin. Repeat the test with this fix.

See https://issues.apache.org/jira/browse/ZEPPELIN-2375

### Screenshots (if appropriate)

### Questions:
* Does the licenses files need update?
No

* Is there breaking changes for older versions?
No

* Does this needs documentation?
No

Author: Christian Fries <em...@christian-fries.de>

Closes #2235 from cfries/master and squashes the following commits:

3635ed8 [Christian Fries] [ZEPPELIN-2375]: Avoid modification of CLASSPATH variable.


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/a3c78a4f
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/a3c78a4f
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/a3c78a4f

Branch: refs/heads/master
Commit: a3c78a4f49653ee66b0316c694bf57bf1c38a53b
Parents: bc1b4be
Author: Christian Fries <em...@christian-fries.de>
Authored: Sat Apr 8 22:00:33 2017 +0200
Committer: Lee moon soo <mo...@apache.org>
Committed: Sat Apr 22 19:21:51 2017 -0700

----------------------------------------------------------------------
 bin/interpreter.sh | 10 ++++------
 bin/zeppelin.sh    |  4 ++--
 2 files changed, 6 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a3c78a4f/bin/interpreter.sh
----------------------------------------------------------------------
diff --git a/bin/interpreter.sh b/bin/interpreter.sh
index a9d8f32..29d0221 100755
--- a/bin/interpreter.sh
+++ b/bin/interpreter.sh
@@ -64,7 +64,7 @@ fi
 
 . "${bin}/common.sh"
 
-ZEPPELIN_INTP_CLASSPATH=""
+ZEPPELIN_INTP_CLASSPATH="${CLASSPATH}"
 
 # construct classpath
 if [[ -d "${ZEPPELIN_HOME}/zeppelin-interpreter/target/classes" ]]; then
@@ -190,8 +190,6 @@ fi
 
 addJarInDirForIntp "${LOCAL_INTERPRETER_REPO}"
 
-CLASSPATH+=":${ZEPPELIN_INTP_CLASSPATH}"
-
 if [[ ! -z "$ZEPPELIN_IMPERSONATE_USER" ]]; then
     suid="$(id -u ${ZEPPELIN_IMPERSONATE_USER})"
     if [[ -n  "${suid}" || -z "${SPARK_SUBMIT}" ]]; then
@@ -204,12 +202,12 @@ fi
 
 if [[ -n "${SPARK_SUBMIT}" ]]; then
     if [[ -n "$ZEPPELIN_IMPERSONATE_USER" ]] && [[ "$ZEPPELIN_IMPERSONATE_SPARK_PROXY_USER" != "false" ]];  then
-       INTERPRETER_RUN_COMMAND+=' '` echo ${SPARK_SUBMIT} --class ${ZEPPELIN_SERVER} --driver-class-path \"${ZEPPELIN_INTP_CLASSPATH_OVERRIDES}:${CLASSPATH}\" --driver-java-options \"${JAVA_INTP_OPTS}\" ${SPARK_SUBMIT_OPTIONS} --proxy-user ${ZEPPELIN_IMPERSONATE_USER} ${SPARK_APP_JAR} ${PORT}`
+       INTERPRETER_RUN_COMMAND+=' '` echo ${SPARK_SUBMIT} --class ${ZEPPELIN_SERVER} --driver-class-path \"${ZEPPELIN_INTP_CLASSPATH_OVERRIDES}:${ZEPPELIN_INTP_CLASSPATH}\" --driver-java-options \"${JAVA_INTP_OPTS}\" ${SPARK_SUBMIT_OPTIONS} --proxy-user ${ZEPPELIN_IMPERSONATE_USER} ${SPARK_APP_JAR} ${PORT}`
     else
-       INTERPRETER_RUN_COMMAND+=' '` echo ${SPARK_SUBMIT} --class ${ZEPPELIN_SERVER} --driver-class-path \"${ZEPPELIN_INTP_CLASSPATH_OVERRIDES}:${CLASSPATH}\" --driver-java-options \"${JAVA_INTP_OPTS}\" ${SPARK_SUBMIT_OPTIONS} ${SPARK_APP_JAR} ${PORT}`
+       INTERPRETER_RUN_COMMAND+=' '` echo ${SPARK_SUBMIT} --class ${ZEPPELIN_SERVER} --driver-class-path \"${ZEPPELIN_INTP_CLASSPATH_OVERRIDES}:${ZEPPELIN_INTP_CLASSPATH}\" --driver-java-options \"${JAVA_INTP_OPTS}\" ${SPARK_SUBMIT_OPTIONS} ${SPARK_APP_JAR} ${PORT}`
     fi
 else
-    INTERPRETER_RUN_COMMAND+=' '` echo ${ZEPPELIN_RUNNER} ${JAVA_INTP_OPTS} ${ZEPPELIN_INTP_MEM} -cp ${ZEPPELIN_INTP_CLASSPATH_OVERRIDES}:${CLASSPATH} ${ZEPPELIN_SERVER} ${PORT} `
+    INTERPRETER_RUN_COMMAND+=' '` echo ${ZEPPELIN_RUNNER} ${JAVA_INTP_OPTS} ${ZEPPELIN_INTP_MEM} -cp ${ZEPPELIN_INTP_CLASSPATH_OVERRIDES}:${ZEPPELIN_INTP_CLASSPATH} ${ZEPPELIN_SERVER} ${PORT} `
 fi
 
 if [[ ! -z "$ZEPPELIN_IMPERSONATE_USER" ]] && [[ -n "${suid}" || -z "${SPARK_SUBMIT}" ]]; then

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a3c78a4f/bin/zeppelin.sh
----------------------------------------------------------------------
diff --git a/bin/zeppelin.sh b/bin/zeppelin.sh
index 94711d9..44fc2cf 100755
--- a/bin/zeppelin.sh
+++ b/bin/zeppelin.sh
@@ -71,7 +71,7 @@ addJarInDir "${ZEPPELIN_HOME}/zeppelin-zengine/target/lib"
 addJarInDir "${ZEPPELIN_HOME}/zeppelin-server/target/lib"
 addJarInDir "${ZEPPELIN_HOME}/zeppelin-web/target/lib"
 
-CLASSPATH+=":${ZEPPELIN_CLASSPATH}"
+ZEPPELIN_CLASSPATH="$CLASSPATH:$ZEPPELIN_CLASSPATH"
 
 if [[ ! -d "${ZEPPELIN_LOG_DIR}" ]]; then
   echo "Log dir doesn't exist, create ${ZEPPELIN_LOG_DIR}"
@@ -83,4 +83,4 @@ if [[ ! -d "${ZEPPELIN_PID_DIR}" ]]; then
   $(mkdir -p "${ZEPPELIN_PID_DIR}")
 fi
 
-exec $ZEPPELIN_RUNNER $JAVA_OPTS -cp $ZEPPELIN_CLASSPATH_OVERRIDES:$CLASSPATH $ZEPPELIN_SERVER "$@"
+exec $ZEPPELIN_RUNNER $JAVA_OPTS -cp $ZEPPELIN_CLASSPATH_OVERRIDES:${ZEPPELIN_CLASSPATH} $ZEPPELIN_SERVER "$@"