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

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

Closed
wants to merge 1 commit into from

Conversation

cfries
Copy link
Contributor

@cfries cfries commented Apr 8, 2017

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?

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

@cfries cfries changed the title ZEPPELIN-2375: Avoid modification of CLASSPATH variable. [ZEPPELIN-2375]: Avoid modification of CLASSPATH variable. Apr 8, 2017
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
@felixcheung
Copy link
Member

hmm, I can see your approach though I can also see changing CLASS_PATH makes sense in some cases (for example, a custom library to be loaded).

Do you think there is way to accommodate that? also, is there a way this could be configurable to be backward compatible?

@cfries
Copy link
Contributor Author

cfries commented Apr 16, 2017

Hi Felix.

I am not sure if I got your point. The user can change CLASSPATH and zeppelin.sh will use that. Also, the user can change ${ZEPPELIN_CLASSPATH_OVERRIDES} and ${ZEPPELIN_INTP_CLASSPATH_OVERRIDES} to add additional files to the class path without changing CLASSPATH. I assume my change is backward compatible. It is just that the script does not change the CLASSPATH variable. But since the script is not supposed to call another script, this should be OK.
In my option the side effect that the zeppelin.sh is polluting CLASSPATH with the value of ZEPPELIN_CLASSPATH, which is then exported to interpreter.sh is a bug, because it does not allow to use a JAR in zeppelin server which should NOT be used in zeppelin interpreter. With my modification this is possible.
Again: w.r.t. backward compatibility: I would assume that no one should rely on the bug and if he relied on it, he can fix it by setting ZEPPELIN_INTP_CLASSPATH_OVERRIDES or ZEPPELIN_INTP_CLASSPATH.

@cfries
Copy link
Contributor Author

cfries commented Apr 16, 2017

Also: on OS X the zeppelin does not run if you export CLASSPATH. So I assume no body could rely on this issue.

@Leemoonsoo
Copy link
Member

LGTM

@felixcheung
Copy link
Member

great, I review again after rereading what you are saying and I think they make sense and starting ZEPPELIN_CLASSPATH with CLASSPATH should make in compatible

@felixcheung
Copy link
Member

@cfries looks like this PR is now including other changes? Could you rebase?

@cfries
Copy link
Contributor Author

cfries commented Apr 21, 2017

@felixcheung Ups. Sorry for that. Will fix asap...

@cfries cfries force-pushed the master branch 2 times, most recently from ba94f22 to 3635ed8 Compare April 21, 2017 20:49
@Leemoonsoo
Copy link
Member

CI build passed.
https://travis-ci.org/cfries/zeppelin/builds/224499519

Merge to master and branch-0.7 if no further comments.

asfgit pushed a commit that referenced this pull request Apr 23, 2017
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 <email@christian-fries.de>

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

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

(cherry picked from commit a3c78a4)
Signed-off-by: Lee moon soo <moon@apache.org>
@asfgit asfgit closed this in a3c78a4 Apr 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants