Issue2017

classification
Title: jython.bat script pollutes environment! (variables)
Type: behaviour Severity: normal
Components: Core Versions: Jython 2.7
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: amak Nosy List: amak, bobjalex
Priority: Keywords:

Created on 2013-02-22.00:16:17 by bobjalex, last changed 2013-02-26.09:27:47 by amak.

Messages
msg7730 (view) Author: Bob Alexander (bobjalex) Date: 2013-02-22.00:42:56
Using the jython.bat script to run jython results in some user environment variables being modified. Clearly, this is not good  :-)

Of particular note, it changes JAVA_HOME, which can be troublesome since several other programs depend on that variable.

The fix is to put a "setlocal" command as the 2nd line of the script, immediately following the initial "@echo off" line. Or, probably better, just move the existing setlocal line up to that 2nd line position.

Historically, this has been a problem for years with jython.bat. Those who maintain that script should be aware that, unlike Unix, batch scripts do not have their own local copies of the environment. Unless a setlocal has been executed to create a local copy, environment "set" commands affect the calling shell's environment.

Interestingly, a comment in the script says "derived from jruby.bat". But... jruby.bat does not affect its caller's environment, not does jirb.bat. I suspect jython.bat was modeled after a very early jruby.bat  :-)
msg7785 (view) Author: Alan Kennedy (amak) Date: 2013-02-26.09:27:47
Fix checked in at

2.5: http://hg.python.org/jython/rev/5ce837b1a1d8
tip: http://hg.python.org/jython/rev/67fea7719593

Tested on windows server 2003.

Thanks for the report and the suggested fix.
History
Date User Action Args
2013-02-26 09:27:47amaksetstatus: open -> closed
assignee: amak
resolution: fixed
messages: + msg7785
2013-02-26 07:57:32amaksetnosy: + amak
2013-02-22 00:42:56bobjalexsetmessages: + msg7730
2013-02-22 00:16:17bobjalexcreate