Table of Contents
- Introduction and Licence
- Documentation and Support (IRC, manual page, mailing lists, RSS feeds, …)
- Installation
- Upgrade your packages from older mksh
- Development version
- Inclusion in operating systems
- comparison with other shells
- Testsuite Results (regression tests)
- on version numbers – for packagers
- future plans (older or unrealistic ones)
- Upgrade Caveat – for users
- ChangeLog
- information about old versions
mksh(1) R46
This is the website of the MirBSD™ Korn Shell, an actively developed free implementation of the Korn Shell programming language and a successor to the Public Domain Korn Shell (pdksh).
This page is always accessible via a redirection at http://mirbsd.de/mksh, which is the canonical homepage URI. There also is (most of the time) mksh on Freshmeat and an mksh project page on ohlol, a statistics site. mksh is experimentally tracked at Launchpad. Download the Logo as SVG if you want. There’s also a full licence terms overview.
Introduction
The current version of mksh is mksh R46 from
2 May 2013.
In the oldstable bugfixing-only series, the
current version is mksh R44 from 5 March 2013.
Thanks to “Der Verein trash.net” for sponsoring access to a Solaris 8 box. Thanks to Julian “yofuh” Wiesener for just another account on a Sun E420 on Solaris 11β. Thanks to someone who prefers to stay anonymous due to tons of red tape for providing access to an AIX 5.3 system with gcc and xlC installed. (Both are now defunct.) Thanks to Jupp “cnuke” Söntgen for building on AIX in Dresden nowadays. Thanks to HP TestDrive/PvP/DSPP/CLOE, which helps in keeping mksh portable to several Unixes and compilers, and track down some architecture- or glibc-specific bugs. (These days, HP-UX/IA64 only, though.) Thanks to gnubber’s admin (Barry “bddebian” deFreese), as well as Samuel “youpi” Thibault, for providing shell access to a Debian GNU/Hurd system. Thanks to Lucas “laffer1” Holt for ssh access to the MidnightBSD server. Thanks to Waldemar “wbx” Brodkorb for dropping his unused Zaurus SL-C3200 to someone who can actually make use of it to test mksh on OpenBSD. Thanks to Andreas “gecko2” Gockel for access to a couple of Debian and Macintosh boxen and an iPhone 3G. Thanks to Martin Zobel-Helas for an account on an Alpha system. Thanks to Bastian “waldi” Blank for access to an S/390 system and uploading mksh packages to Debian for quite some time. Also thanks to Otavio Salvador and Patrick “aptituz” Schönfeld for uploading a couple of my Debian packages. The Debian GNU/k*BSD and Hurd developers were quite helpful in assisting and testing as well. Thanks to Thomas E. “TGEN” Spanjaard for access to both a NetBSD and a DragonFly system. Thanks to Josef “jupp” / “penpen” Schugt for testing mksh on a Digital Unix (OSF/1 V4.0) system from the Uni Bonn Physik CIP Pool. Thanks to DEChengst from #UnixNL for providing access to a HP/Compaq Tru64 (OSF/1 V5.1B) system, an OSF/1 V2.0 system and an Ultrix 4.5 system. Thanks to Adam “replaced” Hoka for a BSDi BSD/OS 3.1 ISO9660 image and offering to help with HP-sUX testing (now that HP TestDrive went down) and initial porting to Haiku, which was continued at CLT 2010 with help from Stephan Aßmus. Thanks to André “naaina” Wösten for ssh on a QNX box. Thanks to Olivier Duchateau for testing on Slackware and Zenwalk GNU/Linux. Thanks to Winston W. for spotting musl, and thanks to maximilian attems and H. Peter Anvin for almost fixing klibc. Thanks to RT|Chatzilla, Chris “ir0nh34d” Sutcliffe, and others for Win32 platform assistance. (Did I miss anyone? Mail me if so. Some of these are past, anyway.)
What is mksh(1)? – Short answer: The MirBSD Korn Shell. Okay, but what exactly does it do, or why another shell? These questions will be answered here for the people interested. Right now, you only need to know that mksh is a DFSG-free and OSD-compliant (and OSI approved) successor to pdksh, developed as part of the MirOS Project as native Bourne/POSIX/Korn shell for MirOS BSD, but also to be readily available under other UNIX®-like operating systems.
The source code for mksh is available at the MirOS Project mirrors
as well as these of other operating system projects due to being included in these; however, we do not provide binaries.
Find instructions to build and install mksh below, or
ask your operating environment vendor to package and include mksh; we provide
assistance for this task if asked. Licencing permits this as long
as due credit is given to the authors and contributors and the copyright
notices are not removed in their entirety; modifying is allowed (but if
the result is still called mksh, it’s discouraged; talk with us if you
feel you have to modify mksh). The individual licences used are the MirOS
licence, and (for BSD compatibility on other operating systems) the 3-clause
UCB licence and the ISC licence; full
terms are available. pdksh originally was public domain, with a few
exceptions, but these files are not part of mksh R21 or up. The mksh(1) author
(mirabilos) acknowledges the contributions of these people who dedicated pdksh
and oksh to the public, and asserts a collective copyright on the code.
All these licences are DFSG clean and conform to the OSD, and the MirOS
Licence is listed on the pages of the ifrOSS licence centre as well as
in the FSF/UNESCO Directory of Free Software. The MirBSD Korn Shell is OSI Certified
and its manual is Open Knowledge.
To compile mksh, you will need a Bourne or POSIX shell (Solaris
/bin/sh is enough, the Z shell works), a C compiler, system and C
library header files and the standard C runtime. You will also need a set of
standard UNIX® tools on a supported operating system: any recent BSD; Darwin,
Apple Mac OSX; Interix (Microsoft® Services for Unix 3.5, maybe Subsystem for
Unix Applications on Win2003/Vista); GNU/Cygwin; UWIN; GNU/Linux (libc5,
glibc, dietlibc, µClibc, some klibc systems are tested), Debian GNU/kFreeBSD,
GNU/Hurd or GNU/Linux; Sun Solaris (8, 9, 10, 11), OpenSolaris; AIX; IRIX;
HP-UX 11i; OSF/1; ULTRIX; Minix 3; NeXTstep (but not OpenStep 4.2); QNX;
BeOS (with limitations) or Haiku; SCO OpenServer 5 (with limitations) or 6
or SCO UnixWare; …
To run the regression test suite, you will need a not
too antiquated Perl optimally with POSIX.pm or Errno.pm as well as /bin/ed (whose installation is
strongly suggested anyway, because it’s the standard FCEDIT history
editor and standard UNIX® text editor), as well as a controlling terminal,
usually /dev/tty or provided from script(1) or GNU screen.
To use mksh, you only need the C runtime (and any supplemental libraries the binary was linked against) and, optionally, /bin/ed – for interactive use, a controlling terminal is highly recommended because job control does not work without one.
To make full use of mksh(1)’s interactive features, it is recommended to copy the dot.mkshrc file from the source distribution as ~/.mkshrc into the user’s home directory and let the user adjust it to suit his needs. The sample file configures a few aliases and shell functions as well as a sensible prompt ($PS1) and some csh-like directory stack functions and zsh-like hooks. Full use of this file requires a few special UNIX® tools. Note that $ENV must not be set for mksh(1) to parse the ~/.mkshrc file at startup.
Support
We provide an online manual page in HTML and PDF format. Reading books about Korn Shells in general is recommended as further help, but beware of the differences (ATTENTION outdated content behind that link) to other shells. Some ISBNs are listed at the end of the manual page.
The RSS feed collects news and wlog entries regarding mksh.
If you require additional assistance or want to discuss bugs, features or enhancements, write to the mailing list (or subscribe to it). The mailing list can be reached via the GMane archive using either NNTP or HTTP, or at The Mail Archive, although not at MARC. Joining the IRC channel at Freenode (irc.freenode.net, SSL port 6697, insecure port 6667) #!/bin/mksh (no joke, this is really the channel’s name) and #ksh (where you must distinguish AT&T ksh from mksh though) is recommended as well.
Installation
Skip to the section about being included in operating environments unless you really want to compile mksh from source yourself or create a package for your operating system of choice.
First off, you have to download the source code from any of the mirrors listed below, or any other mirror you know of. Alternatively, use the development version from CVS. Official source code distributions are digitally signed with gzsig(1) using the MirOS Project’s current signature key. Please verify the signature as well as the hashes and/or checksums below, so you’re sure the content is intact and the version number on the archive is correct.
Known Mirrors
- https://www.mirbsd.org/MirOS/dist/mir/mksh/mksh-R46.tgz
- http://pub.allbsd.org/MirOS/dist/mir/mksh/mksh-R46.tgz
- https://www.mirbsd.org/MirOS/dist/mir/mksh/mksh-R44.tgz
- http://pub.allbsd.org/MirOS/dist/mir/mksh/mksh-R44.tgz
Checksums and Hashes
- RMD160 (mksh-R46.tgz) = fe3850ceb2af9e277bb0e72fb77a9d85e638befc
- TIGER (mksh-R46.tgz) = 2867c9309c3277a792f4236287f6c0f41ee2e218aa9d6da2
- 697099944 349524 /MirOS/dist/mir/mksh/mksh-R46.tgz
- MD5 (mksh-R46.tgz) = 77c108d8143a6e7670954d77517d216d
- ↑ formal release │ stable bugfix series ↓
- RMD160 (mksh-R44.tgz) = 4cf1525c477c4bece519c024cc73ee6ca064d34a
- TIGER (mksh-R44.tgz) = f1658a67757b42cc8f0f39b6736ef329e34d1d248e204d1a
- 927023341 346239 /MirOS/dist/mir/mksh/mksh-R44.tgz
- MD5 (mksh-R44.tgz) = fe011686319a8c50d5e237fd5e195fd8
- All official distfiles are gzsig(1)d. with our current signature key.
Decompression
We’re using gzip(1)-compressed POSIX ustar(1) distfiles nowadays, so a simple tar xzf mksh-R46.tgz will work.
Patching
If you’re a packager/vendor and need to patch mksh and deviate from the default behaviour for that version which is indicated from $KSH_VERSION, patch your shell to append a space plus a vendor-defined string (examples PLD, Debian) so they can be distinguished. I think this is a reasonable request.
Compilation
Now you’re in the source code directory; Build.sh does all the
magic for you. In theory, invoking the command
% /bin/sh ./Build.sh
should work. Relative paths can be used too, for example, instead of cd(1)ing
to the source directory, you could’ve done
% mkdir build; cd build; /bin/sh ../mksh/Build.sh
It is optionally possible to place files, such as printf.c, into either the current or the source directory. It will need a compile option (see below) to be activated. printf.c is undesirable because it uses stdio, floating point and bloats.
The build script requires a Bourne shell (Solaris /bin/sh, the Heirloom sh, DEC OSF/1
V2.0 /bin/sh), Korn shell (ksh, ksh88, ksh93, pdksh, mksh, oksh,
maybe the MKS ksh), POSIX shell (posh, /usr/xpg4/bin/sh, ash, dash),
related shell (yash, J�rg Schilling’s bsh or sh, the Z Shell), or a Bourne
or POSIX superset (such as GNU bash) to work; the ULTRIX /bin/sh
or the C shell (csh, tcsh) or “bsh” or a scripting shell like the wish won’t.
Accepted arguments are:
- -c mode – set compiler mode:
- combine to use “-fwhole-program --combine” (gcc4)
- dragonegg to use the LLVM Dragonegg plugin with GCC
- llvm to compile to bytecode, optimise there (see the -O/-o options) and link with LLVM tools
- lto to use some kind of Link Time Optimisation with clang or gcc-4.5 and up; with fallback to combine if not found
- -g – build with debug info, Valgrind and LLVM/Clang scan-build assertions, and -DDEBUG in place (mksh R40 and up)
- -j – parallel build (mksh R31d+); use LTO instead if you can
- -M – do not compile but create Makefrag.inc (R39b+)
- -O – (default) with “-c llvm” use “-std-compile-opts” (R40+)
- -o opts – with “-c llvm” use these optimisations (R40+)
- -Q – be (only) a little less verbose
- -r – don’t try to build a pre-formatted version of the manual page using nroff(1) if found – recommended
- -v – display version and exit
Note: “-c somemode”, “-j” and “-M” are mutually exclusive. The least preferred of the actually compiling flavours is -j, and the one we consider best is -c lto (since it achieves the best optimisations). It is sometimes possible to use -j together with -c llvm to parallelise LLVM Bytecode generation, though.
The build script also honours some environment variables detailed at its end.
Operating Environment specific notes
Compiler: ACK
Support for ACK on Minix 3 has been added in mksh R37c with a workaround a known ACK bug (the “const” bug); it is now perfectly usable.
Support for other ACK versions or targets can be user-contributed. It currently lacks a sane frontend supporting things like “cc -E” (ack -E is ignored), at the least, and does not yet process system headers like <sys/types.h>.
Compiler: Borland C++ Builder
This compiler is somewhat supported in mksh R30 with UWIN’s cc wrapper. (We haven’t been able to produce a working executable though.)
Compiler: C68 (C386, etc.)
The Walkers’ C89 compiler is not supported at the moment, but this is mostly due to difficulties in figuring it out. Any people who actually got it to compile anything, especially for both Linux and Minix, for both i386 and m68k, please contact us.
Compiler: DEC/Compaq/HP C for OSF/1 and Tru64
This compiler is fully supported with mksh R33b (partial support did appear earlier).
The ucode based compiler, linker and loader for Digital UNIX (OSF/1) V2.0 on MIPS is supported since mksh R36. It may, however, be forced to link statically to work around a bug in the toolchain.
Compiler: Digital Mars
This compiler is somewhat supported in mksh R30 with UWIN’s cc wrapper and a few kludges. (We haven’t been able to produce a tested executable though, due to general stability issues with the UWIN platform.)
Compiler: GCC
The GNU C Compiler 1.42, 2.7.2.1, 2.7.2.3, egcs (gcc 2.95) and the GNU Compiler Collection (gcc 3.x, 4.x) are known to work, but not all versions work on all targets. Early 2.x versions (like 2.1) may make trouble. Specific C flags, known extensions, etc. are autoprobed; cross-compilation works fine. Use of gcc 4.x is discouraged because of several dangerous changes in how the optimiser works; it is possible to work around their trading off reliability for benchmark-only speed increases, but because mksh developers do not use gcc 4.x this will have to be user-contributed. On the other hand, gcc 3.x (in some cases 2.x) is the best choice for compiling mksh.
On BSDi BSD/OS, where gcc 1.42 and gcc 2.7.2.1 are available, the cc(1) manual page mentions that gcc 1.42 produces more reliable code, so we recommend to build mksh with CC=cc (gcc1) instead of CC=gcc or CC=gcc2 there instead.
Since mksh uses ProPolice, the Stack-Smashing Protector, some GCC versions’ compilates require additional shared libraries. To disable this, pass HAVE_CAN_FSTACKPROTECTORALL=0 in the build environment.
GCC and Valgrind do not always play well together, hence the build option -valgrind adding -fno-builtin to avoid gcc producing code that can access memory past the end of the allocation.
Compiler: HP C/aC++
HP’s C compiler (/usr/bin/cc on HP-UX) is supported in mksh R30 and above; on IA64, only the LP64 model can be used; mksh used to segfault in the ILP32 module (or rather, the system libraries did, I think), so it was default. PA-RISC too works fine, so this compiler is a primary choice.
In mksh R39b and up, you must set CFLAGS='+O2 +DD64' on IA64 to get the same behaviour as previous versions; the 32-bit mode is now the default. The HP-UX bundled compiler /usr/ccs/bin/cc works as well as HP aCC, except of course that it does not optimise. (GCC and C99 extensions aren’t actually used by mksh.)
Compiler: IBM XL C/C++ / VisualAge
IBM xlC 9.0 on AIX 5.3 is supported in mksh R30 and above.
IBM xlC 8.0 on Linux/POWER and IBM xlC 6.0β on MacOS X are on the TODO.
IBM xlC 7.0 on AIX 5.2 is supported in mksh R35c and above.
Compiler: Intel C/C++/Fortran
ICC emulates GCC quite well (too well for my taste), is fully supported in mksh R30 and above on several platforms, but spits out lots (and I mean huge ugly lots) of bogus warnings during compile. We’re not going to work around these; let Intel fix their compiler instead. Some of these warnings were even responsible for bugs in mksh.
I could not get the Intel Compiler 10 for Windows® to work.
mksh enables the ICC stack protector option automaticaly. Compilates usually require the Intel shared libraries to be around.
Compiler: libFirm/cparse
libFirm with the cparse front-end is indistinguishable from GCC and known to build mksh R41 just fine.
Compiler: LLVM
Apple llvm-gcc from Xcode 3.1 had full success with mksh R34.
Vanilla llvm-gcc works fine as well.
Vanilla llvm-clang starting at r58935 produces working code with mksh R36b and up.
Compiler: Microsoft® C/C++
Support for the Microsoft® C Compiler on Interix and UWIN, with the respective /usr/bin/cc wrappers, appeared in mksh R30. The following product versions have been tested:
CL.EXE: Microsoft (R) 32-bit C/C++ Standard Compiler Version 13.00.9466 for 80x86
LINK.EXE: Microsoft (R) Incremental Linker Version 7.00.9466
(both are part of the .NET Common Language Runtime redistributable)
CL.EXE: Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.42 for 80x86
LINK.EXE: Microsoft (R) Incremental Linker Version 8.00.50727.42
(both are part of Visual Studio 2005 C++ Expreß)
You’ll have to change Interix’ cc(1) wrapper though: replace /Op
with /Gs- to disable the stack checks (missing support in libc
for them, they used to be off by default) and remove /Ze.
On Interix (SFU 3.5), this compiler is maturely usable and a good choice.
On GNU/Cygwin, using wgcc it might be possible to use this compiler. I could not test that yet, though.
On UWIN, this is usable as well.
Compiler: MIPSpro
Support for SGI’s MIPSpro compiler on IRIX appeared in mksh R33b.
Compiler: nwcc
Support for nwcc appeared in mksh R36b; it is recommended to use nwcc 0.8.1 with mksh R39c or newer. The stack protector is currently disabled because it introduces errors.
Compiler: PCC (BSD)
Support for the Caldera/SCO UNIX® based, BSD-licenced portable C compiler in the ragge version has been added with mksh R31d. Versions from end of April 2008 onwards are known to work reliably, even with -O enabled. Intermediate bugs that may have appeared are just as quickly fixed.
Compiler: SUNpro
Support for the SUN Studio 12 compiler (cc 5.9) as well as cc 5.8 appeared in mksh R30; other versions might be supported as well. This compiler is a primary choice.
Using SUNWcc on MirBSD/i386
Preparation steps. We assume that Sun Studio is extracted under the /opt/SUNWcc directory and Linux emulation has been set up. From now on, $S is /opt/SUNWcc/sunstudio12.1 (when using an older version, no “.1” at the end).
$ cat $S/../MirBSD/ld # must be executable (0555)
#!/bin/mksh
set -A args -- "$@"
integer i=0
while (( i < ${#args[*]} )); do
[[ ${args[i]} = -dynamic-linker ]] && args[i+1]=/usr/libexec/ld.so
[[ ${args[i]} = -Y ]] && args[i+1]=/usr/lib
let ++i
done
exec /usr/bin/ld "${args[@]}"
In $S/prod/include “mkdir MirBSD_orig” and “mv cc MirBSD_orig/”. In $S/prod/lib “mkdir MirBSD_orig” and “mv *.o MirBSD_orig/” then “mv MirBSD_orig/values-xa.o .” (we need this one).
Furthermore, run “make obj && make depend && make && make sunstuff” in /usr/src/lib/csu/i386_elf then copy the three files obj/sun_crt{1,i,n}.o to $S/prod/lib/crt{1,i,n}.o (they are the MirBSD glue code / startup files).
For some versions, you may need to ensure /emul/linux/lib and /emul/linux/usr/lib do not contain any *.so or *.o files, except for libbfd, libopcodes, libstdc++ (but 12.1 uses the native linker).
In 12, -xO2 is broken; in 12.1 optimisation merely lets ir2hf run out of memory even with ulimit -d ulimit -dS 1572864, hence, -xipo cannot be used either. ☹
Using SUNWcc on MirBSD to build mksh
$ S=/opt/SUNWcc/sunstudio12.1 $ LD_LIBRARY_PATH=$S/prod/lib/sys:$S/prod/lib:$S/rtlibs CC=$S/prod/bin/cc \ LDFLAGS="-Yl,$S/../MirBSD" mksh /usr/src/bin/mksh/Build.sh -r
Compiler: tcc (Tiny C)
Support for Fabrice Bellard’s tcc appeared in mksh R31, although its unability to do ‘-E’ in older versions gave us some headache. The bounds checker is currently disabled as it causes segfaults. Some intermediate versions of tcc break every once in a while.
Compiler: TenDRA (maybe Ten15 too)
Support for TenDRA appeared in mksh R31 and appears to be solid; mksh uses the ‘system’ profile for compiling by default. Users who wish to build mksh with a different profile are welcome to help to port it.
See ULTRIX for an example of getting a ‘POSIX’ profile to work.
Compiler: DEC ucode (MIPS CC)
Since mksh R33c, ucode on Ultrix is fully supported.
Compiler: USL C
This is the vendor compiler on SCO OpenServer and SCO UnixWare. It is recognised from R40f onwards.
Distribution: FreeWRT, OpenADK, OpenWrt
These distributions provide the same support cross-platform, with µClibc and/or eglibc, and thus should behave the same on all supported targets.
Platform: Android
Supported with OpenADK (static eglibc) and NDK (although the build process is currently not feasible with an Android.mk file but possible if the CPPFLAGS and signames.inc are pregenerated; sys_signame[] has been pushed upstream and is in Android 1.6). Integration into both AOSP and the Google master, as /system/bin/sh, has been done and it can be enabled on a per-target basis at the moment; mksh is shipped with Android 3.0 and newer releases and the standard shell of non-emulator builds on Android 4.0 and newer.
Platform: iPhone
This is just Mac OSX, compile (natively, or cross via the SDK) and copy.
Platform: Maemo
This is like Debian, and packaging is available via the Garage and the Extras repository. Helpers (for GUI integration and actual on device testing) seeked.
Toolchain: dietlibc
Fefe’s dietlibc works in mksh R34, although his opinion towards certain standards, such as caddr_t, strcasecmp(3), etc. are weird.
Toolchain: klibc
klibc needs -DMKSH_NO_LIMITS and can then use stock klcc as compiler wrapper (CC=klcc).
Toolchain: musl
Appears to work just fine in R41b and up.
OS: 386BSD
This seems to work with mksh R41, although on 386BSD-0.0new (anything older than 386BSD-0.1) you need to patch the kernel against a close-on-exec bug and a bug when switching the terminal between cooked and raw mode as well add an execve with support for shebangs and long command liness.
OS: AIX
Support for AIX with xlC appeared in mksh R30.
OS: BeOS
BeOS can, with limitations, be used with R40f and up. Job control is not working, and mksh must be rebuilt (once built) by running Build.sh with the same options again but using the just-built mksh as interpreter due to a severe pipe-related bug in the system sh. RT says that “BeOS 5.1(Dano)/PhOS/Zeta” can be supported. He is also trying to figure out how to support BeOS 5.0 and how to distinguish it from 5.1…
OS: BSDi BSD/OS
BSD/OS 3.1 works fine with mksh R33.
OS: Coherent
This is a somewhat experimental port in mksh R41. (More information will follow.) Set TARGET_OS=Coherent manually.
OS: GNU/Cygwin
This operating environment is supported as much as it adheres to standard POSIX/SUSv3 conformant things. No workarounds for .exe suffixes or other platform-specific quirks have been or will be added.
OS: Darwin / Mac OSX
Works pretty well.
OS: Dell UNIX 4.0 R2.2 (SVR4)
This exot has been tested with R40f: gcc is absolutely unusable on this
platform but the vendor compiler works.
Set TARGET_OS=_svr4 manually.
OS: MS-DOS, DR DOS, FreeDOS
DJGPP’s bash.exe fails to run Build.sh, thus this is currently not supported. (We tried!)
OS: DragonFly BSD
Perfect choice. Note /bin/sh compatibility needs a quirk.
OS: FreeBSD
Perfect choice. Note /bin/sh compatibility needs a quirk.
OS: GNU/Hurd
This operating system is supported (on i386) since R29 but not well tested. mksh is part of Debian GNU/Hurd, so it is expected to work.
Starting with mksh R39b, there is no arbitrary limit on pathnames any more, as the operating system requires. (However, there are still other inherent limits in mksh, such as that of an interactive input line.)
OS: GNU/k*BSD
This operating environment has been supported for quite a while as part of Debian and somewhat tested.
OS: GNU/Linux
While POSIX does not apply to “GNU’s Not Unix”, the FHS (ex-FSSTND) does; please convince your distributor to move ed to /bin/ed if not already done. Manual page installation paths are not standardised in older distributions either.
Besides glibc (GNU libc), dietlibc (from Fefe), µClibc (embedded), klibc (for initramfs) and libc5 (on Linux 2.0.38) work, but locale detection is not automatic for some of them.
mksh can be used as /bin/sh on Debian and similarly strict distributions, which allow to use e.g. ash/dash there as well.
OS: Haiku
Haiku can be used with mksh R39c and newer with a recent kernel from r35836 and newer, ca. mid-2010 due to a bugfix wrt. signal handling. gcc4hybrid might not work, gcc2hybrid might work well.
OS: HP-UX
Support for HP-UX with GCC appeared in mksh R29 and works with HP’s C compiler and is no longer experimental in mksh R30. Please use stty(1) to make the terminal sanely usable.
If passing custom CFLAGS, don’t forget -mlp64 (GCC) or +DD64 on Itanium.
OS: Interix
We have only tested SFU 3.5 on Windows® 2000, not SUA on Windows® 2003 SR1 or the version integrated into Vista. Windows 7’s works, gcc only though.
As the Unix Perl which comes with Interix is too old, and the ActiveState Perl has… other issues, to run the regression tests, please install Perl from NetBSD® pkgsrc® instead.
As of mksh R30, the native compiler (cc(1)) is supported in addition to gcc, calling Microsoft C. Do not use the c89(1) wrapper.
If passing custom LIBS, don’t forget to add -lcrypt or any other library providing arc4random(3).
mksh can replace /bin/ksh and /bin/sh without any problems.
OS: IRIX
Support for IRIX64 6.5 appeared in mksh R33b.
OS: LynxOS
Although the promised evaluation version never arrived, someone managed to test mksh R40f on LynxOS 3.
OS: MidnightBSD
mksh is part of MidnightBSD 0.2-CURRENT and above and used as native /bin/ksh; it can be used as /bin/sh as well with a quirk.
MidnightBSD 0.3 uses mksh as /bin/sh indeed.
OS: Minix 3
Minix 3 is supported starting mksh R37b (gcc), R37c (ACK/adk cc). Minix 1 and Minix 2 will never be supported due to size constraints on 16-bit platforms, unless a user contributes code. You will need:
# chmem =1048576 /usr/lib/em_cemcom.ansi # chmem =262144 /usr/lib/i386/as
Append the following line to main.c on Minix 3.1.2a or older:
void _longjmp(jmp_buf env, int val) { longjmp(env, val); }
OS: Ninix 3
Ninix 3 (Minix 3 with NetBSD® code) has first been working starting with mksh R40e (clang). More porting and tests are needed. This is different from “regular” Minix 3. Do be sure to set your TARGET_OS environment variable correctly.
OS: Minix-386
mksh R42 works on Minix-386 down to version 1.7.0 but not 1.5 due to OS limitations; you might have to compile on version 2.0 as the ACK bundled with 1.7 segfaults.
OS: Minix-vmd
mksh R42 works fine on Minix-vmd 1.7 with ACK.
OS: MiNT / FreeMiNT
Support appeared in mksh R40. Depending on the distribution you use, you must use pdksh with CC=gcc to run Build.sh – cc and bash are both too broken. Afterwards, you must use the just-built mksh (after moving it out of the build directory) to re-run Build.sh with the same flags, due to bugs in pdksh on MiNT as well.
Most things work. FD_CLOEXEC is broken, so filedescriptor privacy has POSIX level only. /dev/tty is usually unusable; it might help to symlink /dev/console there but break other things.
(At OpenRheinRuhr 2011, tg@ had access to a FreeMiNT distribution which did not seem to exhibit any of the mentioned problems. YMMV.)
OS: MirBSD
Perfect choice. This is where mksh comes from.
OS: MSYS
mksh compiles on MSYS (that is something different from using MinGW for the nascent native WinAPI port; it’s basically an old version of Cygwin wrapped) with few issues.
OS: NetBSD
Perfect choice.
Starting with NetBSD 1.6, mksh can replace /bin/ksh and /bin/sh without any problems. On NetBSD 1.5, mksh can only replace /bin/ksh safely.
OS: NeXTstep
Except for OpenStep 4.2 which has a completely botched POSIX library (although rumours are there is a libposix.a in existence that can be copied onto it), it works with R40f onwards. (Binaries of NeXTstep 3.3 can be copied onto OpenStep 4.2 and used there.) You need gawk.
OS: OpenBSD
The setlocale(3) call in OpenBSD’s libc will always return the “C” locale and therefore has been disabled by default.
mksh can replace /bin/ksh and /bin/sh without any problems. mksh is supposed to be a superset of oksh (except GNU bash-style PS1, weird POSuX character classes, and an incompatible ulimit builtin change).
OS: DEC/Compaq OSF/1, Compaq/HP Tru64
Digital Unix is somewhat supported using gcc as of mksh R31b. With mksh R33b, many more versions and the native compiler work. In fact, gcc sometimes segfaults, so use the vendor compiler.
OS: Plan 9
Needs retesting with mksh R40+ (port unfinished)
Plan 9 is not supported yet – we were able to create an executable, but it did not return to the prompt after running a non-builtin command; this is job control issues, and patches are welcome. (Note this is for R37 and below; R37b might actually work, but someone would have to test this.)
Due to the unavailability of ttys, job control will never be supported. With -DMKSH_NOPROSPECTOFWORK it will probably work. (Note that this option produces a shell not supporting standard Korn Shell scripts.)
The APE (ANSI’n’POSIX Environment) is required to build mksh; I don’t remember which compiler I used, but I think it was GCC.
OS: PW32 on Win2k
PW32 is not supported yet – killpg(3) is missing, and it’s possible that PW32 needs job control disabled or worked around, since a workable binary can be made with -DMKSH_NOPROSPECTOFWORK (note that this option produces a shell not supporting standard Korn Shell scripts). Maybe peek at how ash/bash for PW32 do it. gcc works.
OS: QNX/Neutrino
QNX/Neutrino (Perl: “nto”) support appeared in mksh R36b.
The QNX ed(1) used to fail the regression tests due to being broken; compile the MirBSD ed and place it in /bin/ to fix this, or get an updated ed from vendor.
OS: SCO OpenServer, SCO UnixWare
SCO OpenServer 5 lacks job support, which SCO OpenServer 6 and SCO UnixWare 7.1.1 appear to have working.
OS: SkyOS
RT managed to build mksh on SkyOS. It somewhat works, and the testsuite failures are probably all bugs in their POSIX layer.
OS: Solaris
Solaris is full supported since “forever” with gcc, and since mksh R30 with Sun’s C compiler. Both 32-bit and 64-bit modes work; 64-bit mode is not enabled by default by Build.sh, you must do that manually by passing CFLAGS of -O2 -m64 or -xO2 -xarch=generic64.
Solaris does not come with Berkeley mdoc macros for nroff, so using the HTML or PDF versions of the manual pages or pregenerating a catman page on another OS is required.
OS: SunOS
On mksh R42, add -DMKSH_TYPEDEF_SIG_ATOMIC_T=int and -DMKSH_TYPEDEF_SSIZE_T=int in addition to -DMKSH_UNEMPLOYED -DUSE_REALLOC_MALLOC=0 and SunOS 4.1.1 with GCC 2.7.2.3 will work.
OS: Syllable Desktop
Needs retesting with mksh R40+ (port unfinished)
This OE is suffering from bugs, although R41 works better than ever before. When deactivating any and all job handling with -DMKSH_NOPROSPECTOFWORK it works a bit better. (Note that this option produces a shell not supporting standard Korn Shell scripts.)
Syllable Server will work, as it is, at the moment, “just” a GNU/Linux distribution with a different GUI. This may change though.
OS: ULTRIX
Even on ULTRIX 4.5, mksh R33c works fine. The system ksh must be used for running the Build.sh script, though.
I could not get networking on ULTRIX 4.0 (SIMH) to work, so I could not test it there.
You however must pass the -YPOSIX option to the ucode compiler, as the default -YBSD profile produces a broken executable (spins instead of starting up), and the -YSYSTEM_FIVE profile does not even compile. See TenDRA for another OE which has issues with different OE profiles. (Build.sh takes care of this automatically.)
OS: UWIN-NT
Compilation of mksh R30 on UWIN works with several compilers (bcc, dmc, msc – I could not get gcc-egcs, gcc-2.95, gcc-mingw, icc to work) but the platform itself is very flakey, and even some regression tests crash, due to target limitations apparently. Within these limits, mksh is usable.
OS: Windows
Michael Langguth, partially under work sponsored by his employer Scalaris AG, is currently working on porting mksh to native Win32 (WinAPI) to complete the GNU utilities for Win32 with a native shell to have a free interoperability solution for scripting. Progress is promising, but still a long way to go. The result will probably not be part of mksh itself, but a separate product; some core patches will however end up in core mksh.
OS: Xenix
SCO Xenix 386 2.3.4a lacks too much functionality to be an mksh target. (RT tried!)
After compiling
The Build.sh script generates an executable (“mksh”, except on
GNU/Cygwin, where it is called “mksh.exe”), a shell script to use the newly
built mksh to run the regression test suite (“test.sh”), and (unless the
-r option was given) a pre-formatted manual page (“mksh.cat1”).
It also lists installation instructions unless -Q was provided.
Now it’s the time to run
% ./test.sh -v -f
in order to see if the shell works. The regression testsuite will exit
with errorlevel 1 if any tests failed that are not marked as allowed to
fail (e.g. OS dependent) or expected to fail, 0 otherwise. Omit the ‘-f’
option if you do not have a fast (say 1½ GHz Pentium-M) machine.
The regression tests need a controlling tty. Please ensure you have one, even for bulk/dæmonised builds; you can use GNU screen or script(1) to provide one by running the testsuite inside it (see the Debian and OpenSuSE Buildservive packaging for examples of how to do it). If, however, you absolutely cannot get the necessary utilities and devices installed in the build chroot, run: ./test.sh -v -C regress:no-ctty
To actually install mksh, copy the binary to some place in $PATH, i.e. /bin/mksh, $HOME/.bin/mksh, /usr/local/bin/mksh, or whatever your packaging system wants; strip it and run chmod 555 on it. (This can easily be achieved with install(1) – on Solaris, this is /usr/ucb/install not /usr/bin/install – with the arguments -c, -s, -m 755¹, and -o/-g. ① with 555, strip(1) cannot write the file any more, chmod 555 afterwards.) Also append its installation path to /etc/shells, install the dot.mkshrc file (usually alongside with the copyright file and other documentation), copy it to /etc/skel/.mkshrc if your operating environment has this means to include default dotfiles; install either the catman page (mksh.cat1) to, for example, /usr/share/man/cat1/mksh.0, or the mdoc page (mksh.1) to the standard location (/usr/share/man/man1/ or /usr/man/man1/ or whatever your operating environment requires). The manual page requires the Berkeley mdoc macros (either the BSD or the GNU groff version) to be installed during formatting time.
Note that a ~/.mkshrc file will not be executed if $ENV is set and not empty, nor is there an /etc/mkshrc.
For packagers: Upgrades
Note: This is not the
ChangeLog, these are the packager-visible upgrade notes regarding
changes in the build system (Build.sh and friends, compiler
support, packaging conventions, bad examples, etc). This is also not
the users' upgrade caveat list.
Packagers also
please note: it’s mksh or “The MirBSD Korn Shell” (“MidnightBSD
Korn Shell” is also appropriate), but never Mksh or
somesuch!
R46: New -DMKSH_BINSHPOSIX to complement the older -DMKSH_BINSHREDUCED. Some lksh stuff is now integrated.
R45: Neither -DMKSH_GCC55009 nor HAVE_SILENT_IDIVWRAPV nor -Wno-overflow are used any more; mksh employs unsigned integer arithmetic now and emulates signed integer arithmetics with defined wraparound using unsigned C integers. Oh, and a workaround for a workaround for a bug in GNU tar in dietlibc was added (hah, nested sentences are nice!).
R44: Please consider switching from R41-stable, which is now oldstable; this release is conservative wrt. R43 and may become stable.
R43: Unbreaks detection of sys_siglist[] and friends’ definitions. The Makefrag.inc generation shows the check categories.
R42b: Dear packagers, please consider subscribing to our miros-mksh mailing list or use the RSS feed. The testsuite is now run verbosely by default; use ‘-Q’ to quieten it.
R42: MKSH_DISABLE_EXPERIMENTAL was made a no-op again for this release, like MKSH_DISABLE_DEPRECATED was for R41. There is a new option DEBUG_LEAKS which is implied by DEBUG, which, in turn, you should never enable in production. Handling of time.h vs. sys/time.h and sys_errlist[] changed. The default dot.mkshrc now uses ${ foo;} constructs ipv $(foo) to save a fork(2) at the cost of using a file in $TMPDIR; adjust if you really need.
R41c: Dear packagers, please consider subscribing to our miros-mksh mailing list or use the RSS feed.
R41b: Some bugfixes in Build.sh and the code; GCC now adds -fno-asynchronous-unwind-tables.
R41: We’re using POSIX ustar archives now. Honours LDSTATIC (which is appended to LDFLAGS and, if not empty (e.g. consists of whitespace), adds more mksh-local code to to the build to avoid pulling in more libc code and improving LTO effect. The -long-options for Build.sh are gone. MKSH_SMALL no longer implies -fno-inline. A “legacy ksh” can now be built. A GCC bug may lead to assertion failures at Build.sh check time; in that case, you may use a workaround only if you ensure that a run-time test succeeds (i.e. must not cross-compile except if the result is manually checked afterwards): arith-mandatory in check.t must pass if -DMKSH_GCC55009 is given (the Debian and OpenSuSE Buildservice packages do the same test without using the Perl testsuite).
Warning! The current Build.sh interface will change in the future. With run-time checks, mandatory testsuite parts, etc. it’s already at its limit, and we’ll be needing a host compiler some time later, which will see it revamped. Do read the upgrade notes!
R40f: Honours AWK. Is a lot more anal wrt. using cached Makefile includes. Persistent history support may show up.
R40e: No longer tries to use GCC and C99 extensions. It has a run-time check in Build.sh which may trigger a core dump; when cross-compiling, preseed with HAVE_SILENT_IDIVWRAPV=0 in the environment to skip the check and always compile in the safety code; the check is for removing the safety code if it is not needed on the target machine (which obviously cannot be checked when cross-compiling) and segfaults if it is needed (by design). Support for various OSes has improved.
mksh R40d has several new options: test.sh ‘-f’ to enable running tests that need a fast machine; the preprocessor flag MKSH_DISABLE_DEPRECATED to disable code that is deprecated and scheduled for removal in the next version; updated dot.mkshrc.
mksh R40c got better support for OPENSTEP, Interix, kFreeBSD, MSYS, Hurd. No packaging changes worth mentioning, though.
mksh R40b changed dot.mkshrc and has a new option for disabling special handling the cat(1) builtin. The system and suid profile have moved to /system/etc/ for Android. Build failures (e.g. broken system includes abusing inline vs. broken GCC --combine) may now be caught earlier, so Rebuild.sh may not be available yet.
mksh R40 has substantially changed Build.sh options, CPPFLAGS, etc. and the testsuite now exits with an error code if tests fail. Please do review your packaging; contact us if necessary. Specifically for embedded systems (do not do this on desktops etc.), the ~/.mkshrc location can be changed at compile time. Several more operating systems are supported. setmode.c is gone and HAVE_MKNOD defaults to 0 now but can be explicitly enabled, provided your OS has setmode(3) and getmode(3), or it is provided in $LIBS. arc4random.c is no longer used, unless specifically called for by -DMKSH_A4PB (e.g. on Cygwin). Upgrade printf.c to the latest version if you use it. First release to officially support Android; quell aliasing “stop” and “suspend” there. MKSH_SMALL doesn’t imply HAVE_REVOKE=0 any longer.
Download the development version via CVS
You can use cvs(GNU) to download the development version of mksh(1), commonly called HEAD (or “trunk” to some). Beware of bugs though we strive to make it installable (at least on MirBSD ☺) at all times.
% env CVS_RSH=ssh cvs -qd _anoncvs@anoncvs.mirbsd.org:/cvs co -PA mksh
You might also want to get the printf.c builtin, but this is optional, strongly discouraged and use it only if you really must:
% env CVS_RSH=ssh cvs -qd _anoncvs@anoncvs.mirbsd.org:/cvs co src/usr.bin/printf
Installation instructions as above, although the Build.sh options, CPPFLAGS, etc. might have changed a little in the meantime. In general, you want the following:
% cd mksh % sh Build.sh -r -c lto
Optionally set CC and other variables, as usual.
Inclusion in other operating systems
Debian GNU/Linux, GNU/Hurd and
GNU/kFreeBSD have an mksh package
maintained us.
Gentoo GNU/Linux has an mksh ebuild
created by Hanno Böck and kept up
to date by bonsaikitten.
Fedora GNU/Linux 14, 15 and 16,
and RHEL 4 and 5 (via EPEL),
6 and 7 (shipping with it, for their customers to use with their ksh88 and
pdksh scripts, as well as an optional shell) now officially contain an mksh package (git pkg repo). There are some Instructions
for activating EPEL (RHEL only), then just type yum install mksh.
The OpenSuSE Build
Service provides an mksh package inside the shells
repo, thanks to Pascal “loki” Bleser and Marcus “darix” Rückert; the
RPMs are available as SRPM (source RPM) as well as for various
distributions.
The inofficial portable SRPM has been retired; the OBS SRPM
has been changed to be buildable on Debian and MirBSD as well as include
the contributed arc4random.c file. There are more
downloads available, just browse a little.
Basically, go to mirabilos’ home project, find the subdirectory most closely matching your GNU/Linux distribution and proceed to the binaries. The SRPMs (source RPM in the */src/ subdirectories) should be all the same.
Fink delivers an mksh package
from Andreas “gecko2” Gockel with broken package versioning.
SMGL (Sourcemage GNU/Linux) has an
mksh
spell in their grimoire, developed by the MirOS Project together with
Daniel “morfic” Goller, updated by Thomas “sobukus” Orgis and Vlad
“Stealth” Glagolev.
In the FreeWRT Embedded GNU/Linux
Appliance Development Kit (meta distribution), the mksh
package is maintained by us. mksh is also the default shell in FreeWRT
trunk (soon to be 1.1) and above. OpenADK
(a FreeWRT 1.0 fork) also contains mksh as an optional package.- OpenWrt Embedded GNU/Linux Distribution also provides mksh (rarely updated) on ADSL/WLAN routers thanks to Felix “nbd” Fietkau.
The Android-x86 Project has
mksh as /bin/sh since 2010-02-25. AOSP and the Google
master build mksh and ash since 2010-08-24/25, and it can be
enabled as /system/bin/sh on a per-target basis or the
default can be switched from ash, which is done for 3.0 and up.
It’s hard to get updates in there, though.
Ubuntu GNU/Linux, the grml (and grml64) Live-CD, and other Debian
derivates also have an mksh package; Knoppix, SIDUX and Nexenta OS (GNU/Solaris)
do not contain or offer mksh. Note: We need
URLs to the packages for these, can anyone provide any?
Arch GNU/Linux users can install
an mksh
package by Daniel “homsn” Hommel, promoted by Thorsten “Atsutane”
Töpper, since the Arch Hurd guys were faster.
T2 SDE (ROCK Linux) contains a package as well.
FreeBSD® Ports (for FreeBSD, very old
DragonFly BSD versions and DesktopBSD) also have a port created by
Andreas “ankon” Kohn and kept up to date by Martin “miwi” Wilke and
Olivier Duchateau. It is
unknown if this applies to PC-BSD too,
but there’s no mksh PBI (yet?).
MidnightBSD uses mports, a
derivate of FreeBSD® ports. Naturally, they deliver mksh as well.
MidnightBSD 0.2-CURRENT from 18th August 2007 onwards has mksh as both /bin/mksh
and /bin/ksh,
i.e. it is the default MidnightBSD Korn shell. From 29 March 2009 onwards, it
is also the default /bin/sh (since MidnightBSD 0.3).
NetBSD® pkgsrc® (native also on recent
DragonFly BSD; available for many other operating systems as well) has a package
created by us and kept up to date by Blair Sadewitz and our very own Ádám
“replaced” Hóka and Dr. Benny “benz” Siegert.
The Desktop NetBSD
project also contains mksh; see the source of their meta
package. This will provide their users with a modern, fast, secure,
featureful shell and enhance the experience.- Beastiebox also comes with mksh as an option. It’s NetBSD® based, mostly.
The MirPorts Framework brings mksh to
OpenBSD, Mac OSX and Interix as well as older MirOS BSD versions, which
have mksh as native Korn Shell.
An inofficial
port for OpenBSD is available.
Nobody dares commit it though, so it only gets updated on request.- ChinaLinux mirrors (and apparently packages) mksh.
The HMUG,
some US-American Apple Users’ Group packages mksh for Darwin, too.- Frugalware Linux contains an orphaned and extremely old mksh package looking for a new maintainer.
- Olivier Duchateau used to provide Slackware/Zenwalk GNU/Linux packages, but a SlackBuild for mksh is also available now
(Open)Solaris packages
exist courtesy of Matt “lewellyn” Lewandowsky
Apparently, there was an OpenPKG
package as well… before OpenPKG went down the commercial drain- Dag Wieërs had an RPMforge package, based on Fedora’s
The PLD
Linux Distribution also has a very actively maintained one by
Kacper “draenog” Kornet and Arkadiusz “arekm” Miśkiewicz- Alt Linux Sisyphus updated their package to the R40 series by now, thanks!
- Sabotage Linux has a port of mksh, too.
- Homebrew for Mac OSX has a Formula for mksh, too.
- There are probably many more, please drop us a note!
- Softpedia lists mksh, just like the FSF/UNESCO directory of Free Software.
- Missing packaging: SuSE native (use OBS for now), MacPorts (none at all), Mandriva/Mageia (use OBS; being worked on), OpenEmbedded (being worked on), iPhoneOS (compile yourself; being worked on), Knoppix and SIDUX (just add them), Nexenta (need a contact person), Arch native (use Community), PC-BSD (use pkgsrc® or so; need a contact person for PBI), OpenSolaris (being worked on), OpenBSD (use unofficial port), BeOS (maybe broken) / Haiku, Slackware native (use SlackBuild), MPE/iX (no response from the volunteers ☹), LynxOS (never got the 30-day eval version they promised me ☹), Plan 9 (slightly broken), Syllable Desktop (broken, kernel issue, may have been fixed in the meantime), Pardus (maybe being worked on?), NetBSD base system (under discussion; pkgsrc® has it), Maemo/MeeGo, Palm WebOS, ...
These packages are not official and have not always been tested by mksh developers; please keep this in mind.
Users' Upgrade Caveat
This does not necessarily list new features, only these which users should be aware of for existing scripts.
R46: Compatibility behaviour (mksh with -o posix, mksh with -o sh, mksh with -o posix -o sh, lksh, lksh with -o posix) changed again slightly. For both, -o posix re-enables parsing leading digit-zero numbers as octal, even though you should know better. You can now set both sh and posix but have to do it with the same command; your distributor can pre-enable both, or just one, for /bin/sh. The manpages for mksh and lksh document the delta better now and point out why you should not rely on POSIX long arithmetic.
R45: mksh in compatibility modes (posix, sh, lksh) no longer parses the &> GNU bash I/O redirection (it breaks previously valid scripts). “set -x” output changed. Enjoy the new dot.mkshrc provided PS4 variable and “doch” alias.
R44: "$@" always generates words.
R43: $'…' is only allowed where strings are.
R42b: Sorry for the “set -e” breakage.
R42: ${ foo;} constructs now handle local, return and exit like functions do; dot.mksh makes use of them to avoid fork(2)s. $'…' works in more places; here strings now use the full recursive parser.
R41c: Sorry for the “set -e” breakage.
R41b: The ERR and EXIT traps are called correctly; in “set -e” mode, functions correctly cause the shell to exit if they return nonzero, even if they contain a list.
R41: Deprecated features (set ±o arc4random; beginning an input line with ‘!’ instead of ‘r’+space) are gone. Numbers beginning with 0 are no longer interpreted as octal (except in lksh). Several fixes may have user-visible impact on the language.
For mksh R41 and up, being a feature superset of OpenBSD ksh (except the broken (GNU bash-style) PS1 and mail support) is demoted, no longer a primary but a secondary release criterium. This was changed to facilitate faster releases, especially when OpenBSD changes are not usable as-is.
R40f: Support for persistent history (which is still discouraged) may show up on platforms previously without it.
R40e: Interpreting "010" as octal number will now emit a warning at run-time. Several bugfixes lead to slightly changed behaviour to conform better to the standards. The worst offending bugs in the persistent history code have been fixed, but its use is still discouraged. THIS VERSION IS BROKEN WITHOUT A HOTFIX which your packager probably added. Tab completion may now shrink the current input line, but still follows the docs.
R40d: Interpreting "010" as octal number is now deprecated and will be removed soon. You can now use “local” and “set -A” together to create function-local arrays. The test(1) built-in command behaves POSIX conformant. The ^O Emacs mode command now works as it used to when editing the fetched lines. Arithmetic expressions have certain guarantees that are detailed more explicitly in the manpage.
R40c: The hack for when an interactive command begins with ‘!’ to substitute that with “fc -e -” is now deprecated and will be removed with R41 (or R42, we’ll see) despite objection. Write ‘r ’ (letter err plus a space) instead, it’s exactly the same. On the other hand, GNU bash-style array assignments are now a standard feature: x=(a [3]=b); x+=(c [6]=d) now works even in -DMKSH_SMALL. The -DMKSH_BINSHREDUCED fix for ${foo%\?} needed another fix, same for the recursive parser introduced in R40.
R40b: There is a new built-in special command “global” which does the same as “local” except localise every parameter it touches; in short, it does what “typeset” would’ve been supposed to be had it not to double as “local”. Tab completion will now work better. The shell handles bogus environment variable imports more gracefully and doesn’t let the terminal crash hard under some corner cases. ^Cing out of the built-in cat utility is possible.
R40: “set ±o arc4random” is deprecated and will not exist in the next version (R41) any more – the shell uses an LCG internally which is seeded from ASLR. Several POSIX fixes may change behaviour of builtins, substitutions, etc. and some differ now depending on the “set ±o sh” flag. New builtin “cat” (although, if called with a flag, the external cat utility is invoked) and “sleep” (if select(2) could be linked). dot.mkshrc no longer exports $PS1. GNU bash localised strings ($"…") are handled, but (of course❣) untranslated. “foo=<<EOF” cat(1)lessly assigns a here document to a parameter. New KSHEGID, KSHGID, KSHUID variables and PIPESTATUS array. Completely new read built-in command with several new options. Parse command substitutions – $(…) – recursively. HP-UX “test -H” is back, “test -t” (without the “fd” argument) is gone. “set -x” is now inherited by called functions. The x+=y and x+=(y z) notations for appending to variables and (!MKSH_SMALL) arrays are now supported, as are “;&” and “;|” (“;&&” !MKSH_SMALL too) case fall-through without/with re-examination.
Recent Changes
Changes in the current (unreleased) development version:
- [tg] Do not accidentally remove lksh.1 for in-srcdir builds
- [tg] Fix post-build non-‘-Q’ output for lksh
- [tg] Silence some configure-time warnings for clang-3.2 and GCC
R46 delivers these changes:
- [tg] dot.mkshrc: prevent lksh from running it
- [tg] Add the lksh manual page to the mksh distribution
- [tg] Make both lksh and mksh interpret numbers with a leading digit zero (‘0’) as octal precisely iff “set -o posix” is active
- [tg] Point out the octal digit and the integer arithmetic differences from POSuX verbosely in the manual pages (point people who need octals to “set -o posix” and who need longs to lksh) and elaborate on the horrors of ISO C Undefined Behaviour which is allowed to delete all your data
- [tg] Unbreak “set -o” (list flags) in lksh on LP64 machines
- [tg] Implement Emacs mode PgUp as Vi insert mode Cur↑ for Yofuh
- [tg] Allow setting both “set -o sh” and “set -o posix”, if done in the same command; shuffle around compatibility levels (mksh/lksh, with -o sh, with -o posix) again; permit a /bin/sh to set either or both
- [tg] Sync lksh manual page with the exact code ifdefs
- [tg] Change more use of signed integer to use unsigned instead
- [tg] Implement “set -o pipefail” like AT&T ksh93 and GNU bash do
- [tg] dot.mkshrc: provide hd(1) in Pure mksh™ for fallback
- [tg] Implement VALSUBs (value substitutions): ${|REPLY=foo;}
R45 comes with this bag of changes:
- [tg] Make “set -x” print the commands run in escaped form
- [tg] PS4 in dot.mkshrc is now timestamped
- [tg] The &> GNU bash I/O redir is no longer parsed in -o posix, -o sh modes, lksh (breaks valid scripts)
- [tg] Implement ${ …;} more efficiently (deleted-open files)
- [tg] For shf, %#s (if you can get it past GCC’s printf format attribute) calls print_value_quoted, ignoring field width and precision
- [tg] Catch “typeset =” (regression) with better error message
- [tg, Tonnerre Lombard] add “doch” alias to dot.mkshrc which just repeats the last input line with sudo(8)
- [tg] Use unsigned integers for all calculations, to avoid ISO C “Undefined Behaviour” (and implementation-defined behaviour) throughout (most of) the code; emulate signed integer arithmetics using unsigned; not-lksh only
- [tg] Emulate signed modulo naïvely, for correct sign of the result
- [tg] Add <<< and >>> for ROL and ROR (rotate left and right, respectively) operations, <<<= and >>> assignments; bitwise AND the RHS of a shift/rotate op with 31 (not for lksh)
- [tg] Remove a warning by working around a workaround found in dietlibc which works around a bug in broken software such as GNU tar (really!)
- [tg] Correct and simplify list and categorisation of built-in commands as POSIX special and “everything else” plus a flag to keep assignments
- [tg] Handle ((foo)) as “let]” internally to avoid a conflict with user-defined functions called let (LP#1156707)
- [tg] Clean up the code
R44 contains these bugfixes:
- [tg] "$@" always generates words; bug spotted by engla in IRC
- [tg] Optimise print_columns display to use the screen space better
Please upgrade to mksh R43 (or stick on R41c) because of…
- [tg] Do not permit $'…' and $"…" in anything that looks like a string, as old scripts, like ncurses’, depend on behaviour not guaranteed by POSIX regarding unescaped dollar signs there
- [dalias] Make detection of function prototypes more reliable
- [tg] Quote setenv arguments for eval properly in dot.mkshrc
- [tg] Validate parameter names for typeset, export, etc.
- [tg] Provide a classic BSD echo builtin for /bin/sh on MidnightBSD
- [tg] When generating Makefrag.inc put list of check_categories inside
- [tg] Actually test all echo(1) flavours and MidnightBSD /bin/sh hacks
mksh R42b and R41c fix regressions:
- [tg] Correctly initialise memory (Debian #700604)
- [tg] LP#1104543 fix was too strict (Debian #700526)
mksh R42 brings back the release\ {early,often} scheme:
- [tg] Make -DMKSH_DISABLE_EXPERIMENTAL a nop again
- [tg] Quell some LLVM+Clang warnings; overhaul scan-build assert(3)s
- [tg, RT] Bunch of portability and build system fixes
- [tg] Re-enable ${ precmd;} in dot.mkshrc and fix it to retain the errorlevel
- [RT] Port to Minix-vmd, QNX 4, Watcom C; begin porting to SunOS 4.1.1, Xenix, ISC (Interactive) Unix
- [tg] Prefer const-clean sys_errlist[] to strerror(3)
- [tg] Permit $"…" and $'…' everywhere except in the body of here documents that are not here strings
- [tg] Use full recursive parser for double-quoted here strings, and reuse code between here strings and here documents
- [tg] #ifdef DEBUG_LEAKS free all fds and memory on exit (LP#1106116)
- [tg] Don’t close stdout/stderr with redirections, dup /dev/null instead, always, both in dot.mkshrc and the testsuite, it does break!
- [tg] Handle ${ …;} like functions in that local and return DWIW; use it for the big chunk in $PS1 to avoid fork(2)ing (at cost of tempfiles; dot.mkshrc is a sample, adjust to your needs)
- [tg] Document invalid ${a/b/c} patterns in manpage (Debian #698678)
mksh R41b is a bugfix-only release off a stable branch:
- [tg] Fix gettimeofday(2) detection at build time (warning)
- [RT, tg] Build.sh: catch non-working dash printf builtin
- [chris2, dalias, tg] Remove musl libc workaround and use _GNU_SOURCE which they kindly aliased to _ALL_SOURCE, which is implemented now
- [tg] Fix getn and some cases of possible array bounds trespasses
- [chris2, dalias, tg] Use -fno-asynchronous-unwind-tables with GCC
- [tg] Fix a few warnings from libFirm/cparser (mostly -Wsign-compare)
- [tg] Correct mistake when doing hashtable lookup collision resolution
- [tg] Fix running the ERR and EXIT traps in situations with set -e and/or eval (also closes Debian #696823)
- [tg] Fix “command shift”, reported by «ormaaj:#!/bin/mksh»
- [Torsten Sillke] Unbreak linking on AIX (remove -qextchk)
- [tg] Fix regression wrt lists in functions and “set -e” (LP#1104543)
mksh R41 brings a number of bugfixes and new features:
- [tg] Drop “set ±o arc4random” (deprecated in R40)
- [tg] Drop old Build.sh -long-options (deprecated in R40)
- [tg] Change the internal hash algorithm from Bob Jenkins’ one-at-a-time to its NUL-counting, always-changing, better-avalanching MirOS variant NZAAT (with feedback from ciruZ; 75% fill level is reasonable; names tbd in Mirkev/MirJSON)
- [tg] Use $'…' for non-ASCII parameters for re-entry printing
- [tg] Use sane spelling of “read-only” consistently
- [tg] Improve tree -DDEBUG functions (internal/developer use)
- [tg] Reduce stack usage a bit; speed up hash tables at size cost
- [tg] MKSH_SMALL no longer implies -fno-inline
- [tg] Support optional seed in ${parameter@#seed} for security
- [tg] New Build.sh environment configurable: LDSTATIC (empty)
- [tg] Improve LTO effect by always adding our copies of distributed utility function sources when linking statically (i.e. LDSTATIC is not empty)
- [tg] Drop deprecated hack for lines beginning with an exclamation mark
- [tg] No longer interpret numbers beginning with a 0 digit as octal
- [tg] Attempt to use -fwrapv on more compilers
- [tg, RT] Better portability to 386BSD, Debian 0.91, ancient Unicēs
- [tg] No longer use mkstemp(3) or tempnam(3) functions, do our own
- [tg] Fix some bugs in the manual page and Build.sh
- [tg] Add MKSH_NO_CMDLINE_EDITING, MKSH_DISABLE_TTY_WARNING
- [RT] Port to Coherent UNIX
- [tg] Enable some options by default for some ports, for instance, since BeOS can never have a controlling tty, the option disabling that warning
- [tg] Some bugfixes, prompted by RT and Valgrind
- [RT] Disable sigsuspend(2) on Syllable Desktop
- [tg] Fix several issues with typeset -p (LP: #993847)
- [RT] Detect lcc and apply inline fix, e.g. for use with libc5
- [tg] If klibc, set -DMKSH_NO_LIMITS and check for sigsuspend fix
- [tg] Fix some issues found by Coverity and some found while fixing
- [tg] Build.sh options: -t target-filename (instead
of mksh); -L to build a legacy mksh, current changes:
- different $KSH_VERSION “LEGACY KSH” instead of “MIRBSD KSH”
- purely for running ksh88 and pdksh scripts; no command line editing
- use traditional “set -- $(getopt …); echo $?” mode always
- do not keep file descriptors private
- parse leading-zero-digit numbers as octal
- no mksh extension -T
- use “long”, not “int32_t”, for arithmetics
- [tg] fix trimming with positional parameters (Debian #48453)
- [tg] ensure that case end tokens are not mixed up (Debian #220272)
- [tg] make alias definitions in mksh -c work (Debian #517009), hack
- [tg] Apply speed improvements and add MKSH_SMALL_BUT_FAST
- [tg] Fix CONSERVATIVE_FDS use-before-definition bug
- [tg] Correct two regressions when tab-completing (LP: #1025843) and fix bugs in the same code wrt. completion display and other expansions
- [tg] Make quoted output of “typeset -p” AT&T ksh93 compatible
- [tg] Implement ${foo@Q} like ${foo:Q} in make(1)
- [tg] Remove some unused code; more int → bool conversion
- [tg] Fix using here documents in COMSUB etc. (LP: #1030581)
- [tg] Fix ulimit builtin usage to match what limits we actually know
- [tg] Allow overriding /etc location, experts only (LP: #1039713)
- [tg] Update to Unicode 6.1.0
- [tg, Todd Miller] Avoid changing ps(1) output by accident
- [tg, ft, Christian Neukirchen] Detect zsh 2.5.02/NeXTstep for Build.sh
- [tg] Detect musl-gcc wrapper, define _BSD_SOURCE there, which is totally bogus, but musl, just like dietlibc, gets it wrong
- [tg] Improve compile-time assertions
- [tg] Repair select builtin without any choices given
- [tg] Add -DMKSH_GCC55009 hack to avoid some compile-time assertions and introduce arith-mandatory in check.t to substitute for missing that compile-time check; will change
- [tg] Rewrite lots of code to not rely on -fwrapv so much
- [tg] Build.sh: Fix flock(2) detection on GNU/Linux
- [Andrew Kudryashov] Manpage: fix default for HISTSIZE
- [tg] Add debugging aid (split-screen mechanism using GNU screen)
- [Andrew Kudryashov] Manpage, Website: point out correct mailing list
- [tg, Andrew Kudryashov] Fix ~/nonexistant tab completion
- [tg] Optimise sh -c “[^]\t\n"-$&-*;-?[\\`|]*” to exec, inspired by Jilles Tjoelker (-DMKSH_DISABLE_EXPERIMENTAL to ostracise)
- [tg] Fix $? inside eval (RedHat BZ#865121)
- [tg] Implement ksh93 feature ${ foo;} (using tempfiles this time; exclude with -DMKSH_DISABLE_EXPERIMENTAL in R41)
- [tg] Run SIGINT check more reliably in the cat builtin (LP#1058815)
- [tg] Handle ^C in here documents, COMSUB, arithmetics (LP#1069428)
- [tg] Make dot.mkshrc usable with “set -o nounset” / “set -u”
- [tg, Clint Adams] Clean up and optimise the error handling code
- [tg] Fix and add some checks in the testsuite
- [tg] Sort list of variables in the source code when possible
- [tg] Add $BASHPID (for ormaaj) and $EPOCHREALTIME
- [tg] Improve documentation, #ksh IRC channel homepage
- [tg, RT] Minix 2 also doesn’t have gettimeofday(2) ⇒ check for it
- [tg] Fix an input command line editing display redrawing issue
- [tg] Track the tty to keep $COLUMNS and $LINES up-to-date after a SIGWINCH even in scripts
mksh R40f fixes a critical bug as well as this:
- [tg, RT] Implement fcntl(2)-based advisory locking as an alternative iff flock(2) is not found (LP: #912691); keep trying in the face of EINTR
- [tg] Fix severe regression wrt. initialising tty(4) states
- [tg] Improve testsuite, build-time checks and debugging output
- [tg, RT, winstonw] Improve portability to BeOS (works), Cygwin (good), Dell UNIX (works somewhat, but not with gcc), LynxOS (works somewhat), NeXTstep (works but not OpenStep 4.2), USL C compiler, SCO OpenServer (good), SCO UnixWare (good), Plan 9 (still broken), Syllable Desktop (broken?)
- [tg] rlim_t is supposed to be unsigned
- [tg] Some code, warning and spelling cleanup
- [tg] New Build.sh environment configurable: AWK (= awk)
- [tg, DONG-DONG YANG] Add safety net in the Emacs line editing code
- [tg] No longer rely on env(1), id(1), printf(1) in the testsuite, and strcasecmp(3), strcasestr(3), strncasecmp(3) in the code
- [tg, stsc, RT] Reduce system requirements of check.pl further
mksh R40e is another must-have bugfix update:
- [tg, Jilles Tjoelker] skip readonly check in unevaluated ternary twig
- [tg, anonymous] fix all remaining ifs.sh testcases
- [tg] No longer try to build with GCC and C99 extensions
- [tg, Jilles Tjoelker] Do not expand aliases in COMSUB twice
- [tg] Honour UTF-8 multi-byte character boundaries when doing partial tab-completion insertions (LP: #909025) to fix RedHat BZ#745702
- [tg] Fix R40 (BZ#496791) regression with IOACT in TIF (LP: #907224)
- [tg, ft] Darn persistent history code worst offenders (LP: #906914)
- [tg] Fix some gc-sections, GCC and Clang/scan-build warnings/issues
- [tg, 28C3] dot.mkshrc hash functions: partially address LP: #909818
- [tg] Only compile divmod(0x80000000, -1) code in when not unneeded
- [tg, RT] Move mirtoconf checks and INCLUDES_ONLY parts of sh.h around to ensure prerequisites are always available
- [tg, RT, ir0nh34d] Pass mksh.exe to testsuite, if such thing is generated, and deal with Cygwin passing just “mksh” in argv[0] in such cases
- [tg] Imply -DMKSH_ASSUME_UTF8=0 on MSYS; optimise checks
- [tg, Jb_boin] Fix regression introduced in R35b by jaredy’s security patch where TTIME trashed a non-TCOM string argument (e.g. in TFOR)
- [tg] Better support for tcc; fix GCCism that accidentally crept in
- [tg] Deal with UTF-8 when reporting jobs’ commands
- [RT] Add SkyOS to known OS list
- [tg, RT] Support Minix in its variants Minix 3 and Ninix 3 better
- [tg] Drop some Android-specific unused code (lsmod builtin)
- [tg, RT, lewellyn] Support QNX and various versions of BSD/OS better
- [tg] More code cleanup and new developer-only debugging functions
- [tg, Andrew Kudryashov] Fix some tab completion related escaping bugs
- [tg, draenog] Honour COLUMNS and LINES from the environment in scripts
- [tg, winstonw] The sleep built-in utility now blocks more signals
- [tg] Warn when using another deprecated function that will be removed
mksh R40d is a must-have bugfix update:
- [tg] New test.sh ‘-f’ option (same as ‘-C fastbox’)
- [tg] Drop using set -o noglob inside pushd/popd/dirs
- [tg] Use += more in dot.mkshrc and keep strings shorter
- [tg] Correct interworking between local and set -A
- [tg] Fix out-of-bounds memory access on strings of 32 KiB length
- [tg] MKSH_DISABLE_DEPRECATED (for integrators)
- [tg, Jilles Tjoelker] test(1) built-in behaves exactly as POSIX says
- [tg] Move compile-time assertions to Build.sh from misc.c#ifdef DEBUG
- [tg] Invocation documentation is at the bottom of Build.sh
- [tg] test.sh: verbosely look for perl(1) interpreter to use
- [tg] New tests for integers (base 1‥36, base unspecified, base OOB)
- [tg] Correct error paths for typeset -n global state
- [tg] Deprecate interpreting "010" as octal number, will go
- [tg] Improvements re. integer handling; more explicit manpage text
- [tg] Do not use caddr_t on Linux, so dietlibc stops bitching
- [tg, Jilles Tjoelker] Catch division/modulo overflow 0x80000000/-1
- [tg] Emacs mode ^O regression fix when the fetched lines are edited
mksh R40c collects stable development, mostly fixes:
- [tg, Wouter Verhelst] Fix ${foo%\?} in -o sh
- [jonthn, Snader_LB] Fix spelling mistakes
- [cnuke] Fix bugs spotted during porting to OPENSTEP
- [tg, jg71] Unbreak building stristr with MKSH_ASSUME_UTF8 defined
- [tg] Fix most of the issues Jerker Bäck encountered on Interix
- [tg] Wrap access(2) as it may return false positive for X_OK on root
- [OpenBSD] Upper bound Emacs mode command repeat by input line length
- [tg] Improve CPPFLAGS mangling in Build.sh
- [Snader_LB] Several comment, documentation and website fixes/updates
- [tg] Avoid identifiers and cpp(1) macros with two underscores in a row, and those with a trailing underscore; they are reserved for the OS
- [tg] Fix accidental behavioural change wrt some built-in parameters
- [RT, Chris “ir0nh34d” Sutcliffe] Port to MSYS
- [tg, Markus Duft, Bruno Haible] Interix select(2) bug workaround
- [tg] Manpage fixes
- [tg] Deprecate the “command line begins with ‘!’ for fc -e -” wbx hack
- [tg] Promote x=(a b); x+=(c d) to a core mksh(1) feature
- [tg] Testsuite fixes for Hurd, MSYS; warning fixes for dietlibc
- [tg] Fix R40 regression misparsing $(case x in (x) :; esac)
mksh R40b introduces several desired fixes:
- [tg] Don’t busy-loop on nameref ARY=ARY (LHS = RHS)
- [tg, yofuh] Tabcomplete ~foo like $FOO (LP: #710539)
- [tg] Code cleanup, style, and minor assorted fixes
- [tg] Tabcomplete ~foo/M↹ (with slash) economically
- [tg] Add new
experimentalglobal builtin, doing the same as local (typeset, really – but that doesn’t deserve its name) does, except localising all parameters it touches - [tg] Better error messages with non-integral environment imports
- [tg] $RANDOM environment import accepts any string now
- [tg, Lucas Holt] Add setenv cshism to dot.mkshrc
- [tg, Johannes] Allow ^C to interrupt the built-in cat(1)
- [tg, Arkadiusz Miśkiewicz, Kacper Kornet] Fix mksh taking down the entire terminal, hard, when scripts use $COLUMNS and fork off utilities; regression introduced in mksh R37 (sorry, no regression test possible)
- [tg, Arkadiusz Miśkiewicz] Properly mark need-ctty regression tests
- [tg] MKSH_NO_EXTERNAL_CAT – Quell the external cat(1) calls magic
- [tg, Arkadiusz Miśkiewicz] Yes, “echo” is not portable, document
- [tg] Improve content and look of the manual page
- [tg] Move /etc/{,suid_}profile to /system/etc/ on Android
- [tg] Prevent more compiler warnings; catch build errors earlier
mksh R40 is a major everything release:
- [tg] Correct small mistakes in manpage and build script
- [ahoka, tg, stippi, bonefish, cnuke] Port to Haiku (and probably, implicitly, BeOS; this is not tested though)
- [tg, stippi] Add Haiku specific RLIMIT_NOVMON as ‘V’ to ulimit builtin
- [tg] Let Build.sh cope with dirname(1) unavailability
- [tg] In the Emacs editing mode, hi-bit7 octets are now considered “motion characters” for word boundaries – Esc+b, Esc+f, ^W, …
- [tg] Make EXECSHELL default configurable at compile time (embedded)
- [tg] If MKSH_SMALL do not compile in “set -o bgnice” by default
- [tg] Rework how RLIMIT_{AS,RSS,VMEM} map to ‘m’ and ‘v’ ulimits
- [tg] Add some more OS specific limits seen in zsh
- [tg] SUSv4 ${v=a\ b} and "${v=a\ b}" and ${v-a\ b} compliance, tests
- [tg] Make "~/.mkshrc" path configurable at compile time (embedded)
- [tg] Fix SUNWcc 12.1 error message scan in build phase=u
- [tg, Johannes Sixt, Geoff Clare] Fix variable assignment scope during command execution (expansion vs. assignment execution environment); [Herbert Xu, Geoff Clare] Add more regression tests for this
- [tg] Fix single quotes in "${foo#bar}" (differs from "${foo-bar}")
- [oksh] Fix mknod(8) usage message: b|c are not optional
- [tg, oksh] Fix "${x#?}" expansion when quoted (quotes, space)
- [tg] Make default temporary directory configurable at compile time
- [tg] Fix performance deficiencies in the built-in realpath function
- [tg] Deprecate Build.sh -longoptions in favour of short ones: -valgrind becomes -g (like debug), -combine and -llvm become -c {combine,llvm} and the LLVM optimiser flags are passed via -O = -o -std-compile-opts
- [tg] New Build.sh options -c dragonegg (for using the LLVM plugin to GCC 4.5 with inter-module optimisation), -v (version)
- [tg] Document another way to get a coloured PS1 in the manpage
- [tg] Disallow some more kinds to trim a vector; Debian #581867
- [oksh] Simplify some code; RCSID and comment sync with OpenBSD ksh
- [oksh] Apply diff from manuel giraud to keep track of LINENO in a trap
- [tg] Remove arc4random(3) functionality; seed an LCG depending on the OS doing Address Space Layout Randomisation; speed up (we will use either arc4random_pushb_fast(3) if it exists or arc4random_pushb(3) if forced by the user with -DMKSH_A4PB e.g. on Cygwin)
- [tg] Fix spelling mistakes in dot.mkshrc
- [tg] Implement “live” window resize for the Emacs editing mode
- [tg] More fixes for bugs found by Valgrind and LLVM+Clang scan-build
- [tg] For script compatibility support “set ±o arc4random” during a transition period until R40 is out (but issue a warning to stderr)
- [oksh] Add (, ), (( to reserved words in the manual page and fix some formatting errors with GNU groff’s mdoc
- [tg] Make printf.c.1.15 use mksh’s shf_* routines instead of stdio
- [tg] Fix -Wc++-compat except implicit casts from/to "void *"
- [tg] Correct shf buffer I/O routines to avoid a memory corruption bug discovered by Waldemar Brodkorb and other bad effects
- [tg] Fix NULL pointer dereference during iteration loop when checking for alias recursion; discovered by Michal Hlavinka
- [tg] More int → bool conversion, whitespace and general code cleanup
- [tg] Fix window size not being checked during runtime of external programmes by not relying on SIGWINCH so much but instead checking before every interactive editing of a command line
- [tg] Improve mksh(1) manpage coverage, remove mentions of not-mksh
- [tg] Use wcwidth() from system on MirBSD
- [tg] u_int32_t is no longer needed (only for OpenBSD’s pre-ISO-C99 arc4random API, which we no longer call), so don’t provide it from Build.sh any longer
- [tg, tonnerre] Scan for uint8_t and provide if not found
- [tg] Fix realpath builtin for “/file/” arguments wrt. POSIX
- [tg] Do not generate <stdint.h> from Build.sh as file any more if it is missing; rather let sh.h define the types appropriately and fix related compiler warnings
- [tg] Add “cat” builtin (defers to external if options are given)
- [tg] Reduce size by improved string pooling, improving struct packing, lowering size of some allocation chunks, and better code
- [tg] Document 「x=$(eval $(cat)) <<'EOF'」 workaround for the $(…) parsing bug in the mksh(1) manual page and on the Red Hat Bugzilla
- [tg] Add support for handling a “--” argument to more builtins
- [tg] Correct some error messages and typos
- [Jeff Hamilton] Don’t alias stop, suspend on Android (system specific conflict for stop; suspend just joined the boat)
- [tg] Address what few concerns Chris Palmer (Android security team) had: check all multiplications and some additions for integer overflows, mostly in allocation context, and check setres{u,g}id/setuid for EAGAIN iff the target OS is known to be returning it (Linux only, right now)
- [OpenBSD] Some small manpage fixes
- [tg] Clean up mirtoconf and build warnings with some compilers
- [tg] Fix \c? vs. \c~ mis-documentation in mksh(1)
- [tg] Remove the somewhat-portable setmode.c from the mksh source distribution and demote mknod(8) to an optional builtin, disabled by default, manually re-enabled in the installer only on MirBSD
- [tg] Regenerate wcwidth table from Unicode 6.0.0
- [tg] Change behaviour of argument-less exit in traps to match SUSv4, original patch from Jonathan Nieder (Debian #599484)
- [tg] dot.mkshrc no longer exports $PS1, as recommended by Frank Terbeck, to avoid confusing other shells
- [tg] The character width table is now in sync with Unicode 6.0.0
- [tg] MKSH_SMALL doesn’t imply HAVE_REVOKE=0 any longer
- [tg] Ignore a ‘$’ preceding ‘"…"’ (like bash, ksh93)
- [tg] Make “foo=<<EOF” a direct assignment of here document (or here string) to string variable
- [tg] Add KSHEGID, KSHGID, KSHUID variables (idea from Richard K.)
- [tg] Option -d to read specifies a delimiter, like ksh93 (10x dgk)
- [tg] Extension ${foo@#} expands to hash of $foo (mksh specific)
- [tg, Jörg-Volker Peetz] Emacs prev-hist-word resets the counter if other editing commands were run in between; repeat calling works, even together with arguments, now; arguments are 0-based (Debian #603801)
- [tg] Introduce MKSH_NOPROSPECTOFWORK which implies MKSH_UNEMPLOYED and additionally disables job signals, |&, sigprocmask(2), etc.
- [tg] POSIX: trap 'echo foo' UNKNOWN is not a syntax error
- [tg] Do not use <sys/file.h> unless it exists
- [tg] dot.mkshrc: When we set a UTF-8 locale (e.g. for the GNU OS), we must also set -o utf8-mode to match it
- [tg] Don’t append a space after tab-completing a parameter substitution that doesn’t contain a glob/extglob (LP: #710539)
- [tg] Limit history file size to 1 GiB for sanity
- [tg] Add smores, a more(1)-like pager, as shell function to dot.mkshrc (not control character safe but tty aware)
- [tg] Make builtins directly callable; utf8-mode is determined by LC_ALL/LC_CTYPE/LANG environment variables in that case
- [tg] If the interactive shell uses setlocale(3)/nl_langinfo(3) to divine utf8-mode, fall back to environment variables unless success
- [tg] From a direct builtin call, echo(1) behaves POSIXish
- [tg] Replace some MirBSD utilities with links to mksh(1) and ensure some integration to keep compatibility
- [tg] Add a microsecond capable sleep(1) builtin [updated 20110213]
- [tg] If the built-in cat is invoked from a direct builtin call, it now properly handles the POSIXly demanded ‘-u’ option (as a no-op)
- [tg] Support the PIPESTATUS array (like GNU bash)
- [tg] Port to MiNT / FreeMiNT (Atari m68k operating system)
- [tg] Do not close filedescriptor #3 (controlling tty) on UWIN
- [tg] Make the tree printing code safe for re-entrancy of output
- [tg] Implement recursive parser for $(…) to fix RedHat BZ#496791
- [tg] Use the existing state machine, a recursive parser and retracing the input stream for correct x=(…$((…$(…)…))…) parsing
- [tg, Jb_boin] complain about ${x:1:2:3} instead of crashing
- [tg, Jb_boin] make optional printf(1) builtin __CRAZY=Yes clean and prevent it from crashing by reading past end of (invalid) format strings
- [tg] abort(3) on rogue pointers #ifdef DEBUG
- [tg] Correct some documentation, code commentary, etc.
- [tg] Handle the UTF-8 Byte Order Mark in $(…) expressions
- [tg] Speed up reading input by checking for the BOM only once
- [tg] Fix mis-detection of gcc format attribute (false negative)
- [tg] Include some Android specific hacks (no change on other OEs)
- [tg, Jb_boin] In ${foo/bar/baz} expressions, when adjourning empty patterns to avoid running into a busy-wait loop, remember to skip the anchor characters (‘#’ or ‘%’) at the beginning, yet keep the special meaning replacing a string begin or end with a string has
- [tg] Write a pattern optimiser that is run internally before calls to the pattern matching code always (currently, replaces a@(b@(c)d)e with abcde but keeps @(a|a), then (in a second pass) collapses adjacent asterisk (‘*’) wildcards into a single one; this fixes some of the symptoms of severe performance issues our pattern matching code has to the extent that it can prevent busy-looping (found by Jb_boin)
- [tg, Chris “ironhead” Sutcliffe, Chet Ramey, Eric Blake, David Korn] Handle pathnames with exactly two leading slashes well (SUSv4 3.266)
- [tg, Wayne Pollock, Bart Schaefer] Fix here documents, add testcases
- [tg] Fix corner case ${##1}, add tests for that and ${##} and ${#?}
- [tg] Bring back “test -H” ifdef S_ISCDF (for HP-UX) from pdksh
- [tg] Align read-only variable behaviour with (future) POSIX
- [tg] Permit ${foo%(*} on FSH (Debian #619947)
- [tg, rsc] Allow skipping testcases that need a controlling tty
- [tg] Correct skipping the UTF-8 BOM when identifying a file
- [tg] Do not use <stdbool.h> any longer
- [tg] Use double-underscore-framed __attribute__s
- [tg] Always catch SIGALRM (for the sleep builtin)
- [tg, wbx] Functions now inherit a global set -x
- [tg] Do not explicitly initialise static globals to 0/NULL
- [tg] Eliminate some dead code (functions, globals)
- [tg] Correct more tree handling bugs and merge similar code
- [tg] Add “+=” to concatenate scalars and append to arrays
- [tg] Support empty here document delimiters
- [Robert Luberda] Fix the four-argument form of test(1)
- [tg] Drop the pre-POSIX ability to “test -t” without specifying “fd”
- [tg] Defer dropping an alias in favour of a POSIX function to when the function is actually defined and check for the closing parenthesis too
- [tg, Kacper Kornet] Implement a new regression test attribute need-pass: {yes|no} and exit 1 if unexpected fails occur
- [tg] Add ;& and ;| for case
- [tg] Rewrite the read builtin and its documentation; adding -A (read IFS words into array), -a (read octets/wide characters into array), -N/-n (read only / up to z bytes), -t (read with timeout)
- [tg] Add -e option to cd -P (POSIX 2011)
- [tg] Update dot.mkshrc to use the new features
- [tg] Fix gsf’s ifs.sh tests of the read builtin
- [tg, cnuke] Improve support for AIX, Cygwin, IBM XL C
- [tg] Add tests for x+=(y z) and ;;& extensions
- [tg, hondza] Fix regression in tab completion result display
- [tg, Frank Terbeck] Fix parsing x=(…) expressions
- [tg, Jb_boin] Increase hash table limit; don’t crash when reaching the limit; work around bug in GCC 4.1 on Debian Etch
- [tg] New -c lto option to use Link Time Optimisation (GCC) with automatic fallback to -c combine if unavailable
- [tg] Improvements for -c dragonegg, -c llvm (with gcc+dragonegg, or llvm-gcc and clang, respectively), and TenDRA
- [tg] Let code samples in check.t and dot.mkshrc take care of the new features; fix some longstanding bugs in them
- [tg] Add missing flush in rewritten read builtin for prompting
- [tg] Minix builds now automatically disable the ulimit builtin
Future Plans
- bind keys of dynamic length ‣ begun in a branch
- dynamic input LINE length, instead of a hardcoded value at compile time
- cache optimised extglobs (especially for ${foo/bar/baz})
- typed variables; using ${var@?} more (JSON!)
- make arrays use hashtables internally ipv linear linked lists
- associative, multidimensional arrays
- Build with more platforms’ native tools or other compilers – ACK, kencc, ICC/UWIN, egcs/UWIN
- Build and actually work on more platforms – DJGPP, PW32, Plan 9, Syllable – debug these
- Bugfix for suspending a && b chain
- “process substitution” echo diff <(echo 1) <(echo 2) #606821 ‣ pretty hard, it turns out (parsing concept is done in tg@’s head)
- whence -p -a foo
- read -e (or something): use the edit.c stuff for inputting
- Allow trimming arrays (e.g. ${foo[*]@Q})
- older/unrealistic plans
- … such as a better website, more clearly arranged, etc…
- Although there is definite need, eventually, to have 64-bit arithmetics, possibly using a long typeset flag and something similar to $((#x)) for unsigned arithmetics
- arbitrary-precision arithmetics?
- $& in/after replacements, possibly as array? maybe not with that name, see the &> disaster.
- something like ${${foo#bar}%baz} like other shells do?
- some sort of mktemp(1) builtin; the functionality is already mostly there, but we keep it open already in C and don’t do dirs, this must be rethinked wrt. UI (the UI can also be used for some file-based locking builtin)
- exec with arg parsing, -c like ksh93 (keeping l_assign stuff exported!), -a
- The DEBUG trap (although GNU bash also has a RETURN trap, and both bash and ksh93 write lots about this, so careful design is required before attempting this)
- AT&T ksh93 discipline functions are occasionally mentioned. Shell-private variable namespaces have their use. Accessors too.
