Author ryanwatkins
Recipients amak, fwierzbicki, ryanwatkins
Date 2012-04-10.00:09:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Hi Alan,

Here are replies to your questions.  The answers to 2 & 3 were provided to me by a colleague who made the actual code changes in Jython for IBM i:

1) I did the diff against the Jython 2.5.1 download jar file's Lib/ file.

2) IBM i has processes that run in either EBCIDC or ASCII character encodings.  Java always runs with Unicode and has its stdin, stdout, stderr streams as ASCII streams.   Depending on the shell interpreter, shell scripts will either run with EBCDIC stdin, stdout, stderr streams or ASCII streams.   The native EXEC module in Java that handles calling sub processes does inline stream conversion between EBCDIC and ASCII for sub process streams.  Whether conversion happens, which streams are converted, and how the conversion settings are propagated down the sub process chain is controlled by complex logic in that uses a set of IBM i specific environment variables.   To avoid having streams incorrectly converted and mangling characters and data, we've addressed the issue in Jython at the time we launch sub-processes to allow IBM i Java and native code to handle the process environment inheritance.

3) The original block of code was: 
           self._setup_env(dict(os.environ if env is None else env),

In this block of code the 'env' variable is a caller provided environment.  The os.environ will get the current set of environment variables from Java.  On IBM i we only want to call self._setup_env(...) if the caller explicitly passes an environment variable map in 'env'.  If they don't explicitly pass an environment we want Java and the shell environment to handle the environment inheritance which correctly handles complex logic for inheriting and changing values of the ASCII/EBCDIC stream process environment variables.

As it was, the code was using os.enviorn to set the child process environment which was overriding the Java/shell process logic and setting the ASCII/EBCDIC stream handling/converting environment variables incorrectly.

4) /QOpenSys/usr/bin/sh is the default shell on all IBM i systems. Here is a link stating so:
Date User Action Args
2012-04-10 00:09:07ryanwatkinssetmessageid: <>
2012-04-10 00:09:07ryanwatkinssetrecipients: + ryanwatkins, fwierzbicki, amak
2012-04-10 00:09:07ryanwatkinslinkissue1842 messages
2012-04-10 00:09:07ryanwatkinscreate