This patch contains two fixes. The first fix is an
added method execOS400. This method is called to
execute commands in the POSIX shell. It was necessary
to have a separate execOS400 from the execUnix because
the 'cd' to the working directory had to be quoted
differently to avoid an error message when the user
does not have a home directory. What was happening
was the cd and the directory path were being
interpreted as two commands. The cd command would try
to change directories to the user home, and if it
didn't exist, the TCL user would get an error message
to this effect every time a command is exec'ed.
The second fix is in the cmdProc method. OS/400 runs
in EBCDIC vs ASCII character encodings. Thus, any
call to an POSIX command such as ls will return it's
results in an EBCDIC code page. When the result is
returned to Java under the original implementation, it
was interpreted incorrectly and resulted in
unprintable characters. The fix in the attached file
checks for the existence of a Java property
tcl.lang.childEncoding, that the user of TCL can set
to the name of their code page, for instance "Cp037"
is the English EBCDIC code page. If this property
exists, the stderr and stdout of the process returned
by Runtime.exec are converted from the given code
page. If the property doesn't exist, it will use the
original implementation (no conversion).
This fix has been tested on OS/400 v4r4, v4r5, and and
early version of v5r1.
Patched ExecCmd.java