KSH-93is the most recent version of the KornShell by David Korn of AT&T Bell Laboratories. KornShell is a shell programming language which is also compatible with sh, the original Bourne Shell.
- When exiting a subshell after a command substitution, ksh could prematurely exit without any error. With this update, ksh no longer terminates under these circumstances and all subsequent commands are processed correctly.
- KornShell keeps a list of all non-zero return codes of old child processes with the list size limited by the maximum number of child processes. Previously, this list was not updated properly. Therefore, when PID numbers were reused on long running shells, ksh could erroneously return the exit code of the old process that had used the same PID number like the process that just exited. With this update ksh has been modified to ensure that the list of child processes return codes is updated properly, and the error no longer occurs in the scenario described.
- In KSH-93, when calling a function that was defined by using the function keyword, an additional subprocess was created, unlike for functions defined without this keyword. This update applies an upstream patch, which modifies behavior of KSH-93 so that no additional subprocesses are created under these conditions.
- On Red Hat Enterprise Linux 5, not all kernel methods and user space utilities for file time stamps manipulation support nanosecond resolution. Previous ksh versions always used nanosecond resolution when comparing modification date of files. Therefore, when comparing files on
ext4file systems, ksh returned unexpected results even though
ext4file systems support nanosecond resolution. With this update, ksh has been modified to use only second resolution and file time stamps comparison now produces correct results in the scenario described.
- BZ#736195, BZ#709774
- Previously, when executing multiple piped commands within a script, there was a large time window between creating the child process and executing a command in the child process. This caused various problems with scripts relying on output of the
pscommand because the
pscommand detected more instances of the same script. With this update, this time window has been significantly reduced so the
pscommand now detects only one script instance.
- When running a script, the previous version of ksh could incorrectly consider the
evalcommand to be the last in the script, and did not run it in a separate process. Consequently, using
evalor executing commands from another file (that is, by using the
.built-in command) may have prevented ksh from executing any subsequent commands. With this update, the underlying source code has been adapted to determine whether a script contains other commands and to perform the selected action in a separate process if it does. As a result, ksh now executes all commands in a script as expected.
- Previously, ksh treated an array declaration as a definition. Consequently, the array contained one element after the declaration. This bug has been fixed, and now an array is correctly reported as empty after a declaration.
- BZ#683722, BZ#727891
- If the
IFSvariable was unset inside a function used in a script, the memory being used was erroneously freed. Consequently, ksh terminated unexpectedly with a segmentation fault. With this update, ksh allows the
IFSvariable to be unset, but without freeing the memory so that ksh no longer crashes under these circumstances.
- Assigning a value to an array variable during the execution of the
typesetcommand could cause ksh to terminate unexpectedly with a segmentation fault. This update corrects the array handling in this command and ksh no longer crashes.
- Due to a memory leak in the ksh executable, the performance of long running scripts could decrease significantly over time. With this update, the underlying source code has been modified to prevent this memory leak, and the execution of long running scripts is no longer slowed down.
- In POSIX functions, a function defined without using the function keyword, the value of the variable
$0was changed to the name of the function instead of keeping the original value, the name of the caller function. With this update, an upstream patch has been applied to correct the code and ksh keeps the name of the caller function in
- Prior to this update, ksh did not close a file containing an auto-loaded function definition. After loading several functions, ksh could have easily exceeded the system's limit on the number of open files. With this update, files containing auto-loaded functions are properly closed, thus, the number of opened files no longer increases with usage.
- When a ksh script contained the
trapcommand to capture a
SIGPIPEsignal, sending this signal via the built-in
echocommand could cause its output to be incorrectly added to the redirected output of an external command. With this update, ksh now flushes the output buffer before redirecting any output streams.
- Due to incorrect signal handling, receiving a signal while still processing the previously sent signal caused ksh to terminate unexpectedly with a segmentation fault. With this update, the subsequent signals are deferred until the current signal is processed; thus, ksh no longer crashes.
- Previously, ksh became unresponsive when pipes were used in an
evalargument. With this update, an upstream patch has been applied and the ksh no longer hangs in the scenario described.
- Previously, the
ulimitbuilt-in function did not properly handle setting of the limit for virtual memory usage, which was set by the
-vparameter. Consequently, every time this limit was modified, also the CPU time limit was changed, which was undesirable. This update modifies handling of the virtual memory limit so that it does not influence the CPU time limit anymore.
- BZ#699823, BZ#726199
- When running a ksh script, the exit code of a child process was not preserved. Consequently, when a script asked for such an exit code, the wrong value was reported. With this update, ksh now stores exit codes of child processes so that the exit codes are available for the future use.
- When a ksh script created a file and immediately opened it after the creation, the operation failed. This happened because, in some cases, the file being created did not exist yet. With this update, this race condition has been fixed and once a file is created, it is immediately available for any following commands.
- File name completion used after an environment variable failed and ksh reported a bad substitution error. With this update, an upstream patch has been applied which fixes the problem.
- Previously, ksh did not always wait for a
pipelineto complete when the
pipefailoption was used. Consequently, a failed exit status was erroneously reported even when the
pipelinehad not failed. With this update, the code has been improved and the
pipefailoption now functions as expected.
- In ksh, when performing nested command substitution, each command is performed in a separate
coprocess. The previous version of ksh did not handle the nested command substitutions correctly, which could result in a race condition between job routines in the signal handler and the parent process. Subsequently, ksh could erroneously close stdout of the running coprocess. With this update, ksh now checks whether the coprocess is running before it attempts to close its file descriptor. KornShell now handles the nested command substitutions properly.
- Previously, ksh did not restore file handles after executing a sourced script. If an
output streamor an
error streamwas redirected in the sourced script, the respective stream remained redirected in the parent script as well. With this update, file handles are restored after execution of sourced scripts so a parent script is not affected by sourced script redirections.
- If a
heredoc- specifies a string literal in command line shells) was combined with an auto-loaded function, interference with the
heredocument processing could occur causing output to be truncated to
8 KB. This update improves the
heredocument processing logic and auto-loaded functions no longer have a negative side effect on
- As a result of a previous code optimization, the
whencebuilt-in command could enter an infinite loop when used with the
-qoption. Consequently, ksh consumed up to
100% of CPUand became unresponsive. With this version of ksh, the underlying code of the
whencebuilt-in command has been modified and ksh no longer hangs, when
-qoption is used.
- When performing certain operations, such as reading the user's input, ksh switches the terminal into
raw modewith echo disabled. Normally, the terminal is restored with the previous settings after the operation has been finished. This did not work in the previous ksh version if the user's
localewas set to use multibyte encoding (for example UTF-8). With such a locale, ksh failed to restore the terminal settings if it timed out while executing the
readbuilt-in command. Subsequently, the terminal did not echo any characters until it was reset. This updates applies a patch ensuring that the terminal is restored properly after timeout and user's input is now echoed as expected.
killbuilt-in command did not properly handle errors when it was given an extremely large value as the PID parameter. The
killcommand then internally reported the code -1, which was interpreted by ksh as the
-1option and ksh thus killed all user processes. This update corrects handling of PID conversion errors so that ksh can no longer misinterpret the
killcommand return values. The command now, under these circumstances, fails with an error as expected.
- The ksh built-in
ulimitcommand now provides the ability to read and set the