Overview of the OpenSolaris
Korn Shell 93 Integration Project

[Draft Version 1.0 as of 2007-02-27, the final version will be available at the conference]

Roland Mainz
Bahnhofstraße 5
35390 Gießen
Germany
roland.mainz@nrubsig.org

Abstract

The aim of this talk is to describe the Korn Shell 93 [ksh93] Integration Project, outlining the origins and goals of the project. We describe the "new" Korn Shell [ksh93] features, and its improvements/advantages over the "old" korn shell [ksh88]: performance, usability, administration, localisation, internationalisation, mathematical functions, networking and builtin commands, and its components, including libshell - the ksh93 core library.
We present our project's status and progress, focusing on architectural difficulties and problems we encountered and solved.
We further describe the Solaris specific changes to ksh93, and outline future directions for this project: short-term, mid-term and long-term goals, and migration/update status of /usr/bin/ksh [ksh88] to "ksh93" within Solaris and OpenSolaris-based distributions.
We also outline the future utilisation of ksh93 and libshell within the Solaris Operating Environment's core components, as well as various components-related changes and enhancements planned for ksh93.
Finally we provide a description what could/should be done in a (revised) future POSIX shell standard.


Motivation

There are several motivations behind this project - partially seeking to fix longstanding problems and partially looking towards the future of Solaris:

 


Realisation/Challenges/Lessons Learned

Main focus is on interoperability, portability of ksh93 script between platforms, compatibility to the "upstream" version of ksh93, usability and (code) quality - which includes running the AST/ksh test suite and making sure that the initial code which is put back into OS/Net (=Core components of Solaris) passes this test suite without any errors or warnings (in the "C" locale for now).

 

The project progress can be divided into three major parts:
Part one being the development of the initial prototype integration code which can only be described as "failure" (or learning experience) since the AST/ksh build system and code has some unique properties (and doesn't work as we had expected it), part two being the development of the 2nd prototype series and part three the ARC cases and adjustments following the ARC cases and review.
The lessons learned during the first prototype include:

 

Thanks to the lessons learned during the development with the first prototype we started with a different design, focusing on building the autogenerated includes outside the OS/Net tree and then import them for each source update and developing automated solutions to simplify this process, including "buildksh93.ksh".
This script has several tasks, including:

 

The new prototype roughly follows the following process:

  1. Build the "upstream" AST/ksh sources using the buildksh93.ksh script.
  2. Test the resulting "ksh" binary against the test suite (as safeguard to catch any problems early in the native build environment).
  3. Move the new sources into OS/Net:
  4. Build OS/Net tree.
  5. Test the resulting ksh binary using the AST/ksh test suite and compare the results against the test suite results from the native AST/ksh build.

 

Another major issue was to implement 64bit-support. Prior to our project the AST/ksh codebase had 64bit support on various platforms like Dec/Alpha but Solaris/64bit was not supported. We added Solaris/64bit support for both SPARC and AMD64 to the upstream sources but faced the problem that generated sources and includes were not 100% identical to those created in a Solaris/32bit build.
Our solution is to use the unique approach to build both 32bit and 64bit includes/sources separately as described above and then use /usr/bin/diff -D<symbol> to create one "merged" 32bit and 64bit source file.
Example (for SPARC):

...
#ifdef __sparcv9
...
/* 64bit include content */
...
#else /* __sparcv9 */
...
/* 32bit include content */
...
#endif /* __sparcv9 */
...
This solution allows us to keep the original design while supporting multiple targets (32bit, 64bit) for one set of includes.

 

During this longer development phase several improvements were applied to ksh93, too - including an improved filename/variable/etc. expansion mode (now displays a list of choices with index numbers; typing <number><tab> then picks a choice from that list), the addition of almost all mathematical library functions specified by ISO C99 standard and various minor fixes and changes to the codebase (which includes a major cleanup/sweep of almost all build warnings reported by Sun Studio 11).
After most of the development work on the 2nd prototype series was done we started the first ARC case ("ksh93-integration project").

 

We had to file PSARC 2006/587 "/etc/ksh.kshrc for ksh93" to handle a small mistake/leftover from original ARC case - we ARC'ed that there is a new file called /etc/ksh.kshrc but we forgot to specify the content - the file sets the default editor mode to "gmacs" - which was VERY important to improve the situation compared to the old ksh where every user had to configure the editor mode him-/herself (which is a challenge for beginners and a source of major frustration for users of the old korn shell).

 


Finally we filed PSARC 2007/035 "ksh93 Amendments" to handle the remaining issues which came up during development, mainly that...

  1. ... ksh93 defines its own version of "getconf" which supports extra AST and ksh93-specific values (which is mandatory since the ksh93 test suite depends on this version of "getconf", making it impossible to disable this builtin command without causing portability/interoperability issues)
  2. ... the introduction of the AST message catalog generation tools which itself is dependent on ksh93. The problem is that the OS/Net build rules do not allow the execution of a binary build from the normal sources as part of the build itself (including ksh93 and the AST l10n tools) which means that the build machine itself has to provide these tools (otherwise the newly build binary of ksh93 may fail to work if an interface or dependency in something like libc.so.1 (or any other kernel-userland communication interface/protocol) was added, changed, removed etc. (such a condition is called a "flag day" in OS/Net, i.e. these changes require an update of interface/library/etc. (e.g. libc.so.1) on the build machine before the new binaries can be executed)).
    The solution for this problem was pretty much straightforward - we jump more or less two years ahead in the plan and ship those tools at their designated location now. The first putback into OS/Net will then have the l10n message catalog generation disabled until all build machines have been updated to include the new package containing the new tools and at this point we'll enable the generation again.

 


Future work

The ksh93-integration project is a large project (for OpenSolaris.org) and work on it will keep us busy for the next couple of years.
Some tasks which are ahead of us include:

 


Conclusions

Currently the ksh93-integration prototype codebase is being reviewed and we await the approval for integration ("RTI") within the next couple of weeks following the review.

 


References/Links