⚠ This page contains old, outdated, obsolete, … historic or WIP content! No warranties e.g. for correctness!

(The information about the current version, its download, and the changelogs are correct and up-to-date though — plans and older docs aren’t.)

Table of Contents

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; it suffices to say mksh is Ⓕ Copyfree licenced.

mksh must always be written either “mksh” (all-lowercase) or “MirBSD Korn Shell” — there is no other spelling. It’s usually pronounced by spelling out the four letters m, k, s and h individually, or by saying “MirBSD Korn Shell”.

Introduction

The current version of mksh is mksh R59b from 16 May 2020.

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. Thanks to KO Myung-Hun for the OS/2 port. Thanks to Daniel Richard G. <skunk@iSKUNK.ORG> for the z/OS (OS/390) initial porting effort and continued testing. Thanks to all other contributors from IRC and the mailing list, including, but not limited to, those already named and Martijn Dekker, Jean Delvare, izabera, J�rg Schilling, carstenh, jilles from FreeBSD, arekm, Torsten Sillke, slagtc, Stéphane Chazelas, colona, zacts, Seb, Steffen Nurpmeso (sdaoden), Dan Douglas (ormaaj), Dr. Werner Fink, … (in no particular order). Thanks to Brian Callahan from the Rensselaer Polytechnic Institute for bug fixes as well as running test builds on AIX 5.1L with the xlC 5.0.2.0 and gcc-2.9, and on Solaris 8 with Forte Developer 7 C 5.4 and gcc 2.95.2 and 3.4.6 compilers. Thanks Stanley J. Johnson and the MirBSD southern hemisphere manager Finn Thain, who made the A/UX port possible. No thanks to Intel for not including mksh in their programme analysing code. (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.

A collection of some frequently asked questions is available as the mksh FAQ.

If you require additional assistance or want to discuss bugs, features or enhancements, write to the miros-mksh mailing list (or subscribe to it by sending an eMail to the postmaster telling which address to subscribe to which list(s) — in your case, the miros-mksh list, but we have more mailing lists). 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

Checksums and Hashes

SHA256 (mksh-R59b.tgz) = 907ed1a9586e7f18bdefdd4a763aaa8397b755e15034aa54f4d753bfb272e0e6

RMD160 (mksh-R59b.tgz) = d898ba5a55f194e2c373734e4640025ea27fe936

TIGER (mksh-R59b.tgz) = 9c530d16329bc7fa538d614bdb9f1f800e4e7db4cba9d4cc

3167865772 440055 /MirOS/dist/mir/mksh/mksh-R59b.tgz

MD5 (mksh-R59b.tgz) = dce6abffc2036288540b9ba11dfb2ec8

All official distfiles are gzsig(1)d. with our current signature key.

Preformatted Documentation

Decompression

We’re using gzip(1)-compressed POSIX ustar(1) distfiles nowadays, so a simple tar -xzf mksh-R59b.tgz will work. It will create all files in a subdirectory ./mksh/ .

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, define the cpp(GNU) KSH_VERSIONNAME_VENDOR_EXT macro to a C string beginning with a space and a plus sign, followed by a tag of yours, e.g. add -DKSH_VERSIONNAME_VENDOR_EXT=\"\ +aCoolDistro\" to CPPFLAGS so they can be distinguished. I think this is a reasonable request.

In contrast to the old patching mode, this does not require patching the testsuite any more.

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, yash), a related shell (J�rg/Jvrg/Joerg/Jörg Schilling’s bosh or sh, or 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: 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 The options combine and lto were removed, as link-time optimisation has proven to be too fragile in compilers.

— set compiler mode: -g — build with debug info, Valgrind and LLVM/Clang scan-build assertions, and -DDEBUG in place

— build with debug info, Valgrind and LLVM/Clang scan-build assertions, and in place -j — parallel build

— parallel build -M — do not compile but create Makefrag.inc

— do not compile but create -O — (default) with “-c llvm” use “-std-compile-opts”

— (default) with “-c llvm” use “-std-compile-opts” -o opts — with “-c llvm” use these optimisations

— with “-c llvm” use these optimisations -Q — be (only) a little less verbose

— 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

— 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: “-M” is incompatible with “-c somemode” and “-j” — specify LTO and parallel make using your make(1) tool’s facilities instead. Also, “-c dragonegg” does not work with “-j” (the former is ignored).

Note: any kind of “-c somemode” optimisation is brittle: LLVM (both llvm and dragonegg) have not been used for a long time; GCC’s LTO breaks so often we forcibly disable it nowadays and stopped offering it. Run the testsuite if you use one!

The build script also honours some environment variables detailed at its end.

Install this binary as /bin/mksh and its manual page; you may want to also install dot.mkshrc , either directly into the skeleton directory, or with a wrapper /etc/skel/.mkshrc file that reads /etc/mkshrc , especially if packaging for a GNU distribution.

Building lksh

Add the -L flag to the Build.sh to create lksh(1), a variant of the shell that uses POSIX-compliant arithmetics with the host “long” data type, instead of mksh’s guaranteed-reliable 32-bit arithmetics. You probably want to add -DMKSH_BINSHPOSIX and, possibly, -DMKSH_BINSHREDUCED to the command line and install the lksh binary as your system /bin/sh if you go that route. (This shell is not intended to be used interactively. Its purpose is to run legacy sh scripts (especially with the MKSH_BINSHREDUCED option) and POSIX sh scripts, including Debian maintainer scripts.)

Install this binary as /bin/lksh and its companion manpage, but remember that it does not come stand-alone and to always ship the full proper mksh shell alongside it.

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.

IBM xlC 5.0 on AIX 5.1L also works.

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: SmallerC

A port of mksh to SmallerC (smlrc) was begun, but removed because the developer of that compiler refused to even discuss working on it.

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.

Sun Forte Developer 7 C 5.4 2002/03/09 also works.

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: OpenADK

This development kit provide the same support cross-platform, with µClibc, musl and/or glibc, and thus should behave the same on all supported targets.

Distribution: OpenWrt

This distribution provides the same support cross-platform, with µClibc and/or glibc, and thus should behave the same on all supported targets.

Platform: Android

Supported with OpenADK (static) 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: A/UX

mksh R59c and up work on A/UX, but currently can only be compiled with GCC, not the system compiler (although the reader is invited to fix that). Make sure to install all updates and bugfixes for the OS.

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: Jehanne

A Plan 9 derivative with much improved support for the POSIX runtime environment, can run mksh R56c and newer. Still work in progress, both the operating system itself and the mksh port, but usable by now.

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: OS/2

mksh has been ported to OS/2 with kLIBC. The -T option to Build.sh enables “TEXTMODE”, which supports reading CR+LF line endings but breaks compatibility with Unix mksh.

OS: z/OS (OS/390)

mksh is currently undergoing porting to EBCDIC but should already work in an ASCII environment using xlC. z/Linux has less bugs than the USS environment though.

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

Plan 9 is not supported yet. Due to the unavailability of ttys, full job control will never be supported. Input line editing likewise cannot work in drawterm. Currently, a kernel or APE bug requires the use of -DMKSH_NOPROSPECTOFWORK but this doesn’t produce a fully working mksh (some features cause the shell to hang).

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. Jens Staal reports success with kencc though, so I’d suggest using that instead.

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: RTEMS

04:02 < kiwichris> Just dropped by to say I built mksh for RTEMS (http://www.rtems.org/) and can run it on a sparc simulator. 04:02 < xiaomiao> nice! 04:03 < kiwichris> yeah it is; cannot do to much at the moment because rtems is a statically linked binary and commands are 'functions'

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.

A beta version of this is available as announced in this wlog entry.

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!

current: Please remember to subscribe to the mksh mailing list, either directly or via GMane, if you have an interest in mksh, such as packaging it. Thanks!

(unfinished…)

R59b: Correction: Normally, that link goes from rksh , or just ship both.

R59: You can install a link from rmksh to mksh (same for lksh or sh). If necessary, an R58b with the fixes but not the breaking changes can be spun; contact me if needed.

R58: in-tree build of FAQ is broken, sorry — build out-of-tree or with this hotfix instead (cause was Build.sh removed mksh.faq…). GCC’s LTO support was, as announced, removed. Do not build with LTO if you have GCC as compiler, it has wrong-code generation bugs! We try to add -fno-lto to CFLAGS if GCC is detected, since some GNU distributions forcefully enabled LTO by default despite the bugs and upstream not caring about them. The FAQ is now shipped as XHTML snippets with the source code; run FAQ2HTML.sh to build a valid local HTML page, consider installing it

R57: The MKSH_EARLY_LOCALE_TRACKING code was fixed. The testsuite now checks whether there is actually a controlling tty available or not and whether it matches what’s passed for options. The vendor patching info was updated.

R56c: SuSE provided a patch to implement mediæval-scope locale tracking (set ±U if the POSIX locale variables change within the shell); this is provided as-is, use with care, and especially do not use it in a system shell (with -o posix , it throws a warning when triggered, as it invokes non-compliance).

R56b: The offsetof macro of dietlibc and klibc, which is upstream-buggy, is overridden with GCC 3+ to avoid a warning.

R56: Building with -DMKSH_ASSUME_UTF8=0 no longer causes a known failure in the testsuite. Building with dietlibc or klibc though causes a warning about offsetof and dynamic “command”. You can now choose which UTF-8 locale to use with test.sh -U .

R55: make repool needs mksh R55’s bugfix on the host. OS/2 builds with “textmode” (CR+LF as newline) now need Build.sh -T . Persistent history is now supported by lksh as well, unless explicitly disabled. There were some changes related to the build system.

R54: Build.sh now installs both manpages (lksh.1 and mksh.1) independent of how it’s called. Several additional compiler flags are attempted. Porters to Harvey-OS and OS/2 should review their patches.

R53a: this is a botched R53.

R52c: prepare to review use of set +o .

R52b: nothing of note, but prepare to review all mksh scripts to ensure they start with export LC_ALL=C soon.

R52: Android can define MKSH_DEFAULT_PROFILEDIR itself but we don’t. We no longer ship the stop alias.

R51: Please review all mksh scripts, such as a skeleton ~/.mkshrc file, for alias safety and security — in case of doubt, contact us. The EBCDIC and OS/2 ports are not finished, but some improvements are already included. CVS snapshots now use ‘j’ ipv ‘i’ making room for one more stable version; after R51, we will release R53, mostly bugfixes, and roll them all up in R50g.

R50f: If you patch mksh, please do not only update the version in check.t (twice) and sh.h but now in mksh.1 as well; thanks!

Please let the mksh developer team review your .mkshrc files for robustness!

R50e: Better portability; no conflict with system headers defining a “tilde” function; no use of ptrdiff_t any more. The old workarounds for static code checkers are gone. NSIG generation works with GCC 5.

R50d: Nothing to note.

R50c: New HAVE_ISSETUGID define. The example Debian /etc/skel/.mkshrc moved. Security release. Details.

R50b: test.sh output is now clearer.

R50: test.sh now uses $TMPDIR . If you want to build without SSP, define HAVE_CAN_FSTACKPROTECTORSTRONG in addition to HAVE_CAN_FSTACKPROTECTORALL if you have GCC 4.9+.

R49: There is now generated content at build time; it is known that this is beyond the capabilities of some shells such as Coherent /bin/sh . We plan to address this in a later release by rewriting the relevant parts in C, so that a host C compiler will, in addition to a target C compiler, also be required to build mksh.

R48b: Nothing of notewortiness.

R48: We now ship a Windows® icon; just ignore it if you don’t want it. We regularily update dot.mkshrc so you’d better think of a way for your users to get those updates.

older entries

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

Optionally set CC and other variables, as usual.

Unofficial git mirror

github (chosen only for popularity) hosts a read-only, push-only, possibly nōn-fastforward, unofficial git mirror of the mksh source tree. Use at your own risk.

Inclusion in other operating systems

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.

current: (unfinished…)

R59b: The output format of set +o changed.

R59: On OS/2 the test/[/[[ builtins now add executable file extensions to several more checks. The output of some commands changed adding quoting for re-entry safety. Restricted mode is now enabled if the shell is called as rmksh, rsh, rlksh, …. The right-hand side of a string comparison (=, ==, !=) in [[…]] now uses full Korn Shell extglobs (breaking, but eliminating the need for many eval ). There’s now a which function in dot.mkshrc . The global builtin is gone (use typeset -g from R55+ instead), breaking.

R58: HISTSIZE is now limited to 65535, as pre-announced for years. Running set -p interactively in privileged shells obtains the effective privileges.

R57: Bugfix / rollup release, with only a few changes — it has some known bugs; no (known) regressions though.

R56c: Bugfix-only release; some fixes might cause new warnings

R56b: Bugfix-only release

R56: Aliases support ‘.’, ‘:’ and ‘[’ in names again (though “[[” is still forbidden). POSIX character classes and the BSD re_format(7) extensions [[:\<:]] and [[:\>:]] (quoted due to shell syntax issues) have been added (ASCII/EBCDIC only). Some experimental changes to the history code might help with the vanishing entries phenomena. Switching to POSIX mode now disables UTF-8 mode and forces exec to a PATH search and to use execve(2). In dot.mkshrc the hd_mksh function to hexdump using builtins is now always available, and the default editor selection has changed: it’s moved to near the top of the file and now has a priority list users can change.

R55: The POSIX declaration utility concept is introduced, which also applies to commands having variable assignments and redirections preceding them. wait however does not keep assignments any longer. The new \builtin utility forwards the declaration utility flag exactly like command does. The new typeset -g replaces mksh’s previous home-grown global builtin, which is now deprecated and will be removed from a future version. Aliases are now expanded for command, function and value substitutions at parse time (like for functions, and excepting accent gravis-style substitutions), and typeset -f output is alias-resistent; furthermore, alias names are now limited to [A-Za-z0-9_!%,@] , following POSIX, although a non-leading hyphen-minus is also permitted. print -R is now (correctly) roughly equivalent to the POSIX mode echo . The deltas between mksh and lksh, and between normal, POSIX and “SH” mode, are now properly documented in the manual pages. The let] hack is gone. ulimit -a output changed to display the associated flag. $PATHSEP is now pre-defined to ‘:’ (‘;’ on OS/2). $LINENO is now incremented better in eval and alias expansions.

R54: Lazy evaluation side effects and set -e -related error propagation in || and && constructs are now handled properly.

R53a: Tilde expansions of parameters ( ~ , ~+ , and ~- ) now strip . and .. components from their results. The sample PS1 in dot.mkshrc was corrected for users whose home directories are præficēs of others’. Rotation operators were renamed from <<< and >>> to ^< and ^> . var=<< may now be used. Many fixes.

R52c: Prepare to audit all uses of set +o . Handling of "`\"`" is now considered not a POSIX violation, until this issue is officially resolved. Our PDF manpages now use the PA4 paper size enabling printing without the need to scale of crop on both DIN ISO A4 and USA “letter” paper. The manpages now compile with an older version of the mdoc macropackage (in use by e.g. Schillix) installed. command -pv and command -pV now behave POSIX conformant.

R52b: Prepare to audit all scripts to ensure they begin with export LC_ALL=C as we’ll implement locale trackiing some day. Handling of "`\"`" is now again not POSIX-compliant even in posix mode to unbreak existing code (Austin#1015, mktexlsr). set -C; :>foo is now race-free. Some bugfixes.

R52: (( … )) is now a compound command, which changes the way I/O redirections work. ${x#~} , ${x/y/z} , etc. now have tilde expansion enabled. ${x//#y} no longer works, for anchored patterns use only one slash; quotes are now honoured better in such expressions, though. alias stop='\kill -STOP' is no longer defined by default anywhere; source is no longer an alias but a built-in utility, unbreaking it in some cases; the lksh hack to remove an alias upon function definition is removed. issetugid(2) is no longer used for set ±p checks, unbreaking suid in some cases. Handling of "`\"`" is now POSIX-compliant (this breaks scripts)! More bugfixes, although there are (sorry!) still some known bugs ☹

R51: Integers with bases outside of the permitted range are handled as base 10 instead of failing to parse, like ksh93. Korn shell style functions ( function foo { ) now have locally scoped shell options (e.g. set -o noglob ) except in lksh. Much standard code is now protected from being overridden by aliases; the new enable function in dot.mkshrc can be used to enable or disable a built-in utility (such as rename ) or function (including those in dot.mkshrc ) by means of an alias. The feature to unalias an identifier when a POSIX-style function with the same name is defined only persists in lksh, as it is a legacy feature. cat(1), when a flag is given, and printf(1), now prefer an external utility over the builtin reliably. Several bugfixes, such as command -v now handling shell reserved words, impact compatibility.

R50f: unset HISTFILE actually works. Several more bugfixes and robustness improvements. The mksh(1) manpage now documents how to enable/disable the UTF-8 mode based on the current POSIX locale according to how it’s done at startup on some OSes.

R50e: Warning: do not use x=<< inside a function, it has never worked.

Lots of POSIX compliance and bug fixes. New options for the exec builtin.

R50d: Fixed a segfault and a regression in field splitting breaking update-initramfs. Sorry! Also, added a warning about not using unchecked user input in arithmetics — [[ $x = +([0-9]) ]] || die is a useful check. We’ll link a more detailed writeup about it later.

R50c: $RANDOM is no longer exported. Field splitting has improved. This version fixes one security issue of low importance (details) which is mksh-specific, and mksh is not vulnerable to all those GNU bash bugs, some of which affect AT&T ksh93 as well.

R50b: nameref can alias $1 , etc. again.

R50: Arithmetic expressions are now IFS-split, as per POSIX; this matches what the manpage always documented. Due to regressions, the arr=([index]=value) syntax (naming the indicēs during setting an array) is gone for now, and will not reappear in “set -A”, only in the “=(…)” syntax once we get its parsing fixed. Privileges are now dropped upon start unless the shell is started with “-p”.

R49: The hash algorithm has changed (for, hopefully, the last time); the old algorithms are gone from dot.mkshrc too, and the ${foo@#} syntax no longer accepts a seed value (for more variety use the functions from dot.mkshrc ; for hash tables, just xor and rotate the finished stable hash). Some terminal and other issues have been fixed, don’t be surprised.

R48b: Bugfix for multi-line prompts.

R48: The “doch” alias in dot.mkshrc now keeps standard input usable at the cost of the command to be run being logged by sudo(8). If you notice anything unusual (regression) in the interactive display code please report it; sections of that code have been refactored and improved.

older entries

Recent Changes

Changes in the current (unreleased) development version:

[tg] Update character widths (Jamo bugfix)

[spellintian] Fixes

[Jonathan Perkin] Don’t use “test -e” in Build.sh

[Jonathan Perkin] Mac OSX-specific: ensure ulimit -m is present even if it is an alias of ulimit -v (10.4+), for compatibility

is present even if it is an alias of (10.4+), for compatibility [Finn Thain, Stanley J. Johnson] Port to A/UX

[tg] Add older ulimit(2) support, if setrlimit(2) is missing

[tg] More EBCDIC-safeness (slightly…)

[PerlAcademy] Allow all tests to pass with very old Perl 5

[tg] Fix test.sh’s output of tested/expected shell version

[Stanley J. Johnson] Let A/UX default CC to gcc

[tg] Drop “is being ported” warning from A/UX and OS/2, they work

[tg] Include <pwd.h> only if MKSH_NOPWNAM is not defined

[tg] “command -v” must print absolute pathnames, even if $PATH contains relative pathnames under which the command in question was found (orbea)

[komh] Fix absolute pathnames relative to / on nōn-OS/2, too

[tg] Fix some more corner cases related to pathname normalisation

[tg] FAQ: “ ${@?}: bad substitution ” documentation

R59b is a must-have bugfix upgrade for R59 (not R58):

[tg] Handle other tmux $TERM types, pointed out by multi via IRC

[tg] Fix typo in FAQ

[tg] y='a\*b'; [[ $x = $y ]] regression (Martijn Dekker) fix

regression (Martijn Dekker) fix [l0kod] Defuse CLIP OS O_MAYEXEC support (cf. LWN)

support (cf. LWN) [tg] Make set +o output a command to restore the currently set and (new!) cleared options, keep a reset state per session (experimental)

output a command to restore the currently set and (new!) cleared options, keep a reset state per session (experimental) [tg] Correct documentation and code regarding to argv[0] parsing: first ‘-’ for login shells, then ‘r’ case-insensitively for restricted shell, then “sh”*, again case-insensitively, for BINSH_* modes; add tests

parsing: first ‘-’ for login shells, then ‘r’ case-insensitively for restricted shell, then “sh”*, again case-insensitively, for BINSH_* modes; add tests [tg] On OS/2, allow case-insensitive name for direct builtin call

[tg] Always skip startup files if direct builtin call

[tg] Avoid some sometimes-redundant startup codepaths

R59 has some major fixes, also introducing breaking changes:

[tg] Repair out-of-tree builds (noticed by rsc)

[tg] Work around a glibc on Hurd issue in testsuite

[komh] OS/2 filesystem mtime granularity is two seconds (as in FAT)

[tg] Replace while with goto: Coverity was confused

[tg] Fix invocation of some builtins when external utility absent

[komh] Improve automatic executable suffix for test builtin

[tg] Style code, refactor, clean up, optimise

[tg] Use cached egid in test builtin

[tg] Make bind builtin output reentry-safe; safety fixes

[tg] If basename(argv[0]) after leading dash removal begins with an ‘r’ enable restricted shell flag; reported by pmjdebruijn via IRC

[tg] Fix code example in manpage for how tab completion escapes

[tg] Match full extglob pattern RHS of [[ string comparison like ksh93

[tg] Implement which with -a in dot.mkshrc

with in [tg] Remove global builtin (use typeset -g )

builtin (use ) [tg] alias, command, whence: Print alias names quoted

[tg] Implement a new quote-region (Esc+Q) editing command

(Esc+Q) editing command [tg] Document all built-in aliases (requested by msiism via IRC) and those aliases and functions shipped in dot.mkshrc ; completely overhaul builtin and reserved word documentation, for consistency

; completely overhaul builtin and reserved word documentation, for consistency [tg] The manual page now features properly spaced em dashes ☻

[tg] Document that test x = y doesn’t extglob, only [[ x = y ]] does

R58 contains a lot of fixes and improvements:

[lintian] hyphen-used-as-minus-sign (on jessie, not later, ‽‽‽)

[tg] Fix system info gcc dump{machine,version} shell escaping level

[tg] Document KSH_VERSIONNAME_VENDOR_EXT in Build.sh

[tg] Be more explicit about the LTO bug exposed by check.t

[Todd C. Miller] Add -x (file locks) and AIX-specific -r ulimits

[tg] Handle Midipix as test environment and fix some warnings

[tg] Fix some Build.sh issues as Mirtoconf is now used by MirCPIO and MagicPoint

issues as Mirtoconf is now used by MirCPIO and MagicPoint [komh] Improve CRLF to LF conversion

[komh] Ensure ECHO mode is enabled at startup so read has local echo

[komh] Let check.pl retain the PERLIO env variable

retain the env variable [komh] Unbreak nounset-1 test on systems with drive letters

test on systems with drive letters [komh, tg] Make ulimit-3 test work without |& (that is, incomplete ports, i.e. those with -DMKSH_NOPROSPECTOFWORK )

(that is, incomplete ports, i.e. those with ) [tg] Disable xxx-stat-1 test for now, fails when run as root

test for now, fails when run as root [tg] Drop Build.sh flags -c combine , -c lto

flags , [Martijn Dekker] Exit 126 on execve(2) failure, not 1 (e.g. E2BIG)

[tg] Behave set and export/readonly-on-read-only-variables when run with command and command dot , bugreports by Martijn Dekker

and , bugreports by Martijn Dekker [tg] dot.mkshrc : simplify; enhance (un)setting locale example

: simplify; enhance (un)setting locale example [tg, selk] Catch build errors earlier

[tg] Add -fno-lto (if GCC is detected) to CFLAGS and LDFLAGS

(if GCC is detected) to CFLAGS and LDFLAGS [tg] Limit HISTSIZE to 65535, as long pre-announced

to 65535, as long pre-announced [tg] Unbreak testsuite selftest-tty-absent for lksh

for lksh [tg] Begin work on support for neatcc (needs neatcc to evolve first)

[tg] Fix possibly not enough aligned access in struct job

[tg] Support going full setugid by running “set -p” once interactive

[tg] Document another (arcane, almost nowhere needed) definition

[tg] Improve code legibility and testsuite reliability and maintenance

[tg] Speed up trivial += cases (LP#1855167)

[tg] Some further code and memory optimisation and test coverage

[tg] Document that += is always string append (LP#1857702)

[tg] Fix “set -e appears active within eval but isn’t” reported by Martijn Dekker and another bug related to using set ±e inside eval

[tg] Handle parameter assignment in front of invocations of POSIX-style functions like ksh-style ones and external utilities; cf. Debian #935115

[tg] Fix bad memory access for invalid syntax (LP#1857828, LP#1857826)

[Brian Callahan] Update MALLOC_OPTIONS-using testcase for newer OpenBSD

[tg] Support lacc as compiler (just detecting, no change), thanks Brian

[tg] Share __IDSTRING with jupp

[tg] Update string comparison/pattern documentation

[tg, veedeeh] Document vi command line editing mode state better

[tg] Add FAQ2HTML.sh to convert mksh.faq to local valid XHTML+CSS

[tg] Correct backslash expansion documentation; caveat re. 16-bit UCS

[tg] Fix extra empty field on IFS-NWS trim expansion (Martijn Dekker)

[tg] Improve code performance, quality, robustness and correctness

[tg] Allow ${x:n} where n is an identifier (veedeeh)

where n is an identifier (veedeeh) [tg] Permit ‘+’ in alias names, but not leading (Aleksey Cheusov)

[tg] Fix here strings for $@ (LP#1857195), reported by jvdh

[multiplexd] Add vi mode PgDn, similar to PgUp doing history search

[tg] Build.sh fixup unreliable test -n / -z

fixup unreliable / [multiplexd] Correct documentation of vi mode @c

[tg] Update to UCD 13.0.0

[tg] Use nanoseconds in test -nt / -ot (LP#1855325)

R57 rolls up bugfixes, with few hard changes:

[gecko2] Update operating environment reporting for the Macintosh

[Martijn Dekker] make ${foo#'bar'} in here document behave like ksh93

[Martijn Dekker] quote empty strings for re-entry into shell

[tg, G.raud Meyer] Improve documentation, especially for tty states

[tg] Protect against entering line editing with bad saved tty state

[tg] Fix set -o allexport for arrays (which we apparently do)

for arrays (which we apparently do) [tg] Handle lseek(2) returning -1 as pointed out by Coverity Scan

[tg] Fix left-padding UTF-8 strings

[tg, G.raud Meyer] Fix using the “-m” flag on the command line

[tg] Update to UCD 11.0.0

[multiplexd] Fix a segfault using ^W during search in Vi mode

[tg] Fix an error message; add a test for controlling tty

[tg] Permit unsetting LINES and COLUMNS, for those who need it

[tg] Fix manpage bug (RedHat BZ#1612173)

[tg] Minor spelling cleanup

[tg] Unbreak high-bit7 (nōn-ASCII) heredoc separators (LP#1779179)

[tg] Allow dumping high-bit7-char-containing strings in DEBUG mode

[tg] Add some testcases for behaviour questions popped up in IRC

[tg] Trick a GCC warning, to make up for it ignoring lint(1) hints

[tg] Add O_MAYEXEC support for CLIP OS

support for CLIP OS [tg] Make dup-to-self with ksh-style fd≥3 closing work; catern via IRC

[tg] Add compat glue for newer GNU groff mdoc to the manpages

[tg] Trigger EXIT trap after single-command subshells (Debian #910276)

[tg] Document set -eo pipefail caveat (LP#1804504)

caveat (LP#1804504) [tg] Fix MKSH_EARLY_LOCALE_TRACKING warning

[tg] Document that, when your Unix is broken, GIGO applies (LP#1817959)

[tg] Improve error message for inaccessible executables (LP#1817789)

R56c is a bugfix-only release everyone must upgrade to:

[komh] Remove redundant OS/2-specific code, clean up others

[komh, tg] Fix drive-qualified (absolute and relative) DOS-style path support in realpath functionality, partially other places

[tg] Don’t substitute ${ENV:-~/.mkshrc} result again

result again [tg] Improve OS/2 $PATH (et al.) handling, drive-relative paths

[tg] Add MKSH_ENVDIR compile-time option for Jehanne and Plan 9

[tg] Limit nesting when parsing malformed code (Debian #878947)

[tg] Update wcwidth data with bugfixed script (still Unicode 10; resulting values are identical to glibc git master for extant chars)

[Dr. Werner Fink] Raise some time limits in the testsuite

[Shamar] Add support for the Jehanne operating system

[komh] Set stdin to text mode before executing child processes on OS/2

[komh] Pass arguments via a resonse file if executing a child fails

[Dr. Werner Fink] Early locale tracking as a compile-time option

[tg] Fix regressions introduced with new fast character classes

R56b is a bugfix-only release everyone should upgrade to:

[tg] Reference the FAQ webpage

[panpo, Riviera] Fix documentation bug wrt. Esc+Ctrl-L

[tg, Larry Hynes] Fix “0” movement in vi mode

[tg] Replace broken libcs’ offsetof macro with MirBSD’s

R56 is a bugfix release with some experimental fixes:

[tg, Seb] Do not apply alias name restrictions to hash/tilde tracking

[tg] Restore ‘.’, ‘:’ and ‘[’ in alias names (“[[” is still forbidden)

[tg] Fix accidentally defanged $PATHSEP test

test [tg] On ^C (INTR and QUIT edchars), shove edit line into history

[iSKUNK, tg] Begin porting to z/OS using EBCDIC encoding, incomplete

[tg] Redo fast character classes code, adding POSIX and other helpers

[tg] bind parses backslash-escaped ‘^’ (and ‘\’) as escaped

parses backslash-escaped ‘^’ (and ‘\’) as escaped [tg] Building with -DMKSH_ASSUME_UTF8=0 no longer causes a known failure in the testsuite

no longer causes a known failure in the testsuite [tg] New test.sh option -U to pass a UTF-8 locale to use in the tests

[tg] re_format(7) BSD: [[ $x = *[[:\<:]]foo[[:\>:]]* ]]

[tg, iSKUNK] Use Config in check.pl only if it exists

only if it exists [tg] New matching code for bracket expressions, full POSIX (8bit)

[komh] Exclude FAT/HPFS/NTFS-unsafe tests on OS/2 (and Cygwin/MSYS)

[tg] Update to Unicode 10.0.0

[tg, selk] Make readonly idempotent

idempotent [tg, multiplexd] When truncating the persistent history, do not change the underlying file, do all operations on the locked one; do not stop using the history at all if it has been truncated

[tg, J�rg] Turn off UTF-8 mode upon turning on POSIX mode

[Martijn Dekker, Geoff Clare, many on the Austin list, tg] In POSIX mode, make the exec builtin force a $PATH search plus execve

builtin force a search plus execve [tg] Fix GCC 7, Coverity Scan warnings

[tg, Michal Hlavinka] Track background process PIDs even interactive

[tg] Always expose mksh’s hexdump shell function; speed it up by working on the input in chunks; use character classes to make it EBCDIC safe

[tg] Revamp dot.mkshrc default editor selection mechanism

R55 is mostly a feature release with summary bugfixes:

[komh] Fix OS/2 search_access() and UNC path logic

[tg] Undocument printf(1) to avoid user confusion

[Jean Delvare, tg] Fix printf builtin -R option

[tg] Make ${var@x}, unknown x, fail (thanks izabera)

[tg] ${var=x} must evaluate x in scalar context (10x Martijn Dekker)

[tg] Fixup relation between lksh and mksh, reduce delta

[tg] Improve manpage display; add OS/2 $PATH FAQ

FAQ [Jean Delvare] Fix bugs in manpage

[tg] Review tilde expansion, removing “odd use of KEEPASN” and introduce POSIX “declaration utility” concept; wait isn’t one

isn’t one [tg] Add \builtin utility, declaration utility forwarder

utility, declaration utility forwarder [tg] Make $'\xz' expand to xz , not \0

expand to , not [tg] Use fixed string pooling (requires the above change in host mksh)

[tg] POSIX declaration commands can have varassign and redirections

[Martijn Dekker] Add typeset -g , replacing homegrown “global”

, replacing homegrown “global” [Harvey-OS] Disable NOPROSPECTOFWORK, APEX is reportedly fixed now

[tg] Display ulimit -a output with flags; improve Haiku

output with flags; improve Haiku [tg] Drop old let] hack, use \builtin internally

hack, use internally [tg] Fix padding in Lb64encode in dot.mkshrc

in [tg] Move FAQ content to a separate, new FAQ section in the manpage

[tg] Add new standard variable PATHSEP (‘:’, ‘;’ on OS/2)

(‘:’, ‘;’ on OS/2) [Martijn Dekker] Fix LINENO in eval and alias

in eval and alias [komh] Fix “\builtin” on OS/2

[tg] Improve (internal) character classes code for speed

[tg] Fix: the underscore is no drive letter

[tg] No longer hard-disable persistent history support in lksh

[tg] Introduce build flag -T for enabling “textmode” on OS/2 (supporting CR+LF line endings, but incompatible with mksh proper)

for enabling “textmode” on OS/2 (supporting CR+LF line endings, but incompatible with mksh proper) [tg] Merge mksh-os2

[tg] Permit changing $OS2_SHELL during a running shell

during a running shell [tg] Fix multibyte handling in ^R (Emacs search-history)

(Emacs search-history) [tg] Allow “typeset -p arrname[2]” to work

[tg] Make some error messages more consistent

[tg, komh] Disable UTF-8 detection code for OS/2 as unrealistic

[tg, sdaoden] Limit alias name chars to POSIX plus non-leading ‘-’

[tg, Martijn Dekker] Expand aliases at COMSUB parse time

[tg] Make “typeset -f” output alias-resistent

[tg, Martijn Dekker] Permit “eval break” and “eval continue”

[tg] Make -masm=intel safe on i386

safe on i386 [tg] Disambiguate $((…)) vs. $((…)…) in “typeset -f” output

[Jean Delvare] Clarify the effect of exit and return in a subshell

[tg] Simplify compile-time asserts and make them actually compile-time

[tg] Fix ^O in Emacs mode if the line was modified (LP#1675842)

[tg] Address Coverity Scan… stuff… now that it builds again

[Martijn Dekker, tg] Add test -v

[tg] Document set -o posix / sh completely

R54 is a bugfix release with moderate new features:

[tg] Simplify and improve code and manual page

[tg] Try GCC 5’s new -malign-data=abi

[tg] Allow interrupting builtin cat even on fast devices (LP#1616692)

[tg] Update to Unicode 9.0.0

[Andreas Buschka] Correct English spelling

[tg] Handle set -e -related error propagation in || and && constructs correctly

-related error propagation in and constructs correctly [tg] Initialise memory for RNG even when not targeting Valgrind

[tg] Shrink binary size

[Brian Callahan] Improve support for the contemporary pcc compiler

[tg] Fix side effects with lazy evaluation; spotted by ormaaj

[tg] New flags -c (columnise), -l, -N for the print builtin

[Larry Hynes] Fix English, spelling mistakes, typos in the manpage

[tg, ormaaj] Return 128+SIGALRM if read -t times out, like GNU bash

[Martijn Dekker] Install both manpages from Build.sh

[Martijn Dekker] Document case changes are ASCII-only

[Ronald G. Minnich, Elbing Miss, Álvaro Jurado, tg] Begin porting to Harvey-OS and APEX (similar to Plan 9 and APE)

[KO Myung-Hun] More infrastructure for the OS/2 (EMX, KLIBC) port

R53a is a snapshot/feature release:

[lintian] Fix spelling

[tg] Unbreak multi-line command history broken by history flush

[tg] Fix redefining POSIX functions that were Korn functions before

[tg, TNF] Fix bounds checks in Vi editing mode

[tg] Handle combining characters at end of string or output correctly

[tg] Fix ${!#} ${!?} ${!-} (POSIX, prompted by izabera)

(POSIX, prompted by izabera) [tg] Fix shf.c-internal buffer overread on printing digits

[J�rg] Fix a typo in the testsuite

[arekm] Increase default edit line size (unless MKSH_SMALL)

[tg] Improve description of Emacs mode keybindings, especially ^U

[tg, arekm, jilles] Abort read builtin in case of read(2) errors

[tg, izabera, carstenh] Fix most of the ambiguous corner cases related to ${[pfx]var[op[word]]} ( ${@:-1} still unsupported)

( still unsupported) [carstenh] Contribute some more testsuite coverage

[tg] WDS_TPUTS now emits QCHAR newline reentrant-safe

[tg] Fix var=<< implementation (LP#1380389)

implementation (LP#1380389) [tg, FreeBSD] Make XSI test(1) extensions behave as if they were POSIX

[tg, izabera] Add $(<<<x) and $(<<EOF…) implementation

[tg] Lower minimum screen size accepted as “sane” from the OS to 4×2

[tg, Torsten Sillke] Simplify tilde-expanded parameters

[tg, Torsten Sillke] Fix default PS1 for substring matches

for substring matches [tg] Apply defer-builtin-with-arguments logic to realpath builtin

[tg] Rework string pooling (own vs. compiler’s) (LP#1580348)

[tg] Feature: print -A , prints arguments as characters

, prints arguments as characters [tg, izabera] Replace <<< and >>> as ROL and ROR operators with their new ^< and ^> spelling as per this proposal

and as ROL and ROR operators with their new and spelling as per this proposal [tg, slagtc] Clear-to-EOL under tmux to work around its anti-feature

[tg, p120ph37] Remove support for using file descriptors with more than a single digit, in preparation for named file descriptors

[tg] Correct, but simplify (at the potential cost of more tty I/O than strictly necessary, though never redundant and (probably) not more than before when it was miscalculated), line clearing and redrawing

[slagtc, tg] Implement new evaluate-region editing command Esc+Ctrl-E

[tg] Prefer external rename utility over the recovery builtin

[tg] Remove redundant full-line redraws

[tg, Natureshadow] Fix errorlevel of ‘.’ (“dot” special builtin) when the sourced script does not run any commands, for POSIX compliance

[tg] Refactor op tokens and edchars to shave off some more bytes

[tg] Fix some bugs in the manpage and some occasional/minor code bugs

[tg, Brian Callahan] Mark tests requiring new perl as !need-pass

[tg, slagtc] Add $KSH_MATCH and, to make it usable, ${foo@/bar/baz}

[tg, Score_Under] Fix bogus patch from OpenBSD: only NULL the global source in unwind when actually reclaim ing its Area

when actually ing its Area [izabera] Mention in the manpage that integer bases go up to 36

[Natureshadow] Fix /= operator broken during refactoring

R52c is a bugfix-only release:

[tg] Shave 200 bytes off .text by revisiting string pooling

[tg, J�rg] Fix manpage for ditroff on Schillix

[tg, wbx] Use sed 1q instead of unportable head(1)

instead of unportable head(1) [tg] Implement underrun debugging tool for area-based memory allocator

[tg] Fix history underrun when first interactive command is entered

[tg, bef0rd] Do not misinterpret “${0/}” as “${0//”, fixes segfault

[tg, Stéphane Chazelas] Fix display problems with special parameters

[tg, Stéphane Chazelas] Catch attempt to trim $* and $@ with ?, fixes segfault (Todd Miller did this in 2004 for ${x[*]} already, so just sync)

[Martijn Dekker] Fix “command -p” with -Vv to behave as POSIX requires

[tg, jilles, Oleg Bulatov] Fix recusive parser with active heredocs

[tg] Flush even syntax-failing or interrupted commands to history

[tg, fmunozs] Fix invalid memory access for “'\0'” in arithmetics

[tg] Explicitly reserve SIGEXIT and SIGERR for ksh

[tg, izabera] Catch missing here documents at EOF even under “set -n”

[kre, tg] Document Austin#1015 handling (not considered a violation)

[tg, fmunozs] Fix buffer overread for empty nameref targets

[tg] Fix warnings pointed out by latest Debian gcc-snapshot

[tg, Martijn Dekker] Document upcoming set +o changes

changes [Martijn Dekker] Expand testsuite for command / whence

R52b is a strongly recommended bugfix-only release:

[tg] Recognise ksh93 compiled scripts and LZIP compressed files as binary (i.e. to not run as mksh plaintext script)

[tg] Document that we will implement locale tracking later

[tg] Add EEXIST to failback strerror(3)

to failback strerror(3) [jilles] Make set -C; :>foo race-free

race-free [tg] Don’t use unset in portable build script

in portable build script [tg] Plug warning on GNU/kFreeBSD, GNU/Hurd

[tg] Document read -a resets the integer base

resets the integer base [J�rg] Fix manpage: time is not a builtin but a reserved word

is not a builtin but a reserved word [J�rg, tg] Make exit (and return ) eat -1

(and ) eat [tg] parse “$( (( … ) … ) … )” correctly (LP#1532621), Jan Palus

[tg] reduce memory footprint by free(3)ing more aggressively

[tg] fix buffer overrun (LP#1533394), bugreport by izabera

[tg] correctly handle nested ADELIM parsing (LP#1453827), Teckids

[tg] permit “read -A/-a arr[idx]” as long as only one element is read; fix corruption of array indicēs with this construct (LP#1533396), izabera

[tg] Sanitise OS-provided signal number in even more places

[tg] As requested by J�rg, be clear manpage advice is for mksh

[tg] Revert (as it was a regression) POSIX bugfix from R52/2005 related to accent gravis-style command substitution until POSIX decides either way

[tg] Handle export et al. after command (Austin#351)

et al. after (Austin#351) [tg] Catch EPIPE in built-in cat and return as SIGPIPE (LP#1532621)

[tg] Fix errno in print/echo builtin; optimise that and unbksl

[tg] Update documentation, point out POSIX violation (Austin#1015)

R52 is a strongly recommended bugfix release:

[_0bitcount] Move moving external link from mksh(1) to the #ksh channel homepage linked therein

[tg] Make setenv “set -u”-safe and fix when invoked with no args

[tg] Make “typeset -f” output reentrant if name is a reserved word

[oksh] Zero-pad seconds in “time” output to align columns

[tg] Check signals and errorlevels from OS to be within bounds

[komh, tg] Quote and document ‘;’ as PATH separator in some places

[oksh, tg] Simplify code to call afree() even if arg is NULL

[tg] Fix tree-printing and reentrancy of multiple here documents

[tg] Work around LP#1030581 by permitting exactly one space after

[tg, oksh] Code quality work, cleanups

[tg] New code for here documents/strings with several bugfixes

[tg] Stop using issetugid(2) for ±p checks, wrong tool for the job

[tg] Reintroduce some -o posix changes lost in 2005, plus fixes

[tg] Make “source” into a built-in command

[tg] Drop “stop” alias, lksh(1) functionality to auto-unalias

[tg] Fix \u0000 ignored in $'…' and print

ignored in and [tg] Improve portability of Build.sh

[Jilles Tjoelker] Improve portability of testsuite

[tg] Fix tilde expansion for some substitutions (izabera, Chet, Geoff)

[tg] Improve reparsing of ((…) |…) as ( (…) |…)

as [Martijn Dekker] Fix test(1) not returning evaluation errors

[tg] Fix ${*:+x} constructs (carstenh)

constructs (carstenh) [tg] Make (( … )) into a compound command (ormaaj)

into a compound command (ormaaj) [tg] Repair a few parameter substitution expansion mistakes

R51 is a strongly recommended feature release:

[tg] OpenBSD sync: handle integer base out of band like ksh93 does

[tg] Protect standard code (predefined aliases, internal code, aliases and functions in dot.mkshrc ) from being overridden by aliases and, in some cases, shell functions (i.e. permit overriding but ignore it)

) from being overridden by aliases and, in some cases, shell functions (i.e. permit overriding but ignore it) [tg] Implement GNU bash’s enable for dot.mkshrc using magic aliases to redirect the builtins to external utilities; this differs from GNU bash in that enable takes precedence over functions

for using magic aliases to redirect the builtins to external utilities; this differs from GNU bash in that takes precedence over functions [tg] Move unalias ing an identifier when defining a POSIX-style function with the same name into lksh, as compatibility kludge

ing an identifier when defining a POSIX-style function with the same name into lksh, as compatibility kludge [tg] Korn shell style functions now have locally scoped shell options

[tg, iSKUNK] Change some ASCII-isms to be EBCDIC-aware or pluggable

[tg, Ypnose] Mention lksh build instructions on manpage and website

[tg] Overhaul signal handling; support new POSIX NSIG_MAX , add sysconf(_SC_NSIG) as a later TODO item

, add as a later TODO item [tg] Fix signal bounds (1 ≤ signum < NSIG )

< ) [tg] Improve manual pages, especially wrt. standards compliance

[tg, iSKUNK] Initial EBCDIC work for dot.mkshrc

[tg, iSKUNK] Add list of z/OS signals to Build.sh

[tg] Work around the sh(1) backslash-newline problem by moving the code triggering it out of *.opt and into the consumers

and into the consumers [colona] Bind another well-known ANSI Del key in the Emacs mode

[tg] Fix ${foo/*/x} pattern checks, spotted by izabera

pattern checks, spotted by izabera [carstenh] Fix error output of cd function in dot.mkshrc

function in dot.mkshrc [tg] read partial returns in -N and timeout cases

partial returns in and timeout cases [tg] Fix $LINENO inside PS1 ; spotted by carstenh

inside ; spotted by carstenh [tg] Ensure correct padding of at least 2 spaces in print_columns

[tg] Note issues with nested complex parameter expansions and follow-up bugfixes to expect

[OpenBSD] Some language fixes in documentation; comments

[tg] Reimplement multi-line command history (Debian #783978) + fixes

[Martijn Dekker] Fix command -v for “shell reserved words”

for “shell reserved words” [tg] In dot.mkshrc make use of latest feature: local options

make use of latest feature: local options [tg] Fix ""$@ to emit a word

to emit a word [tg] Change cat(1) hack to look first and not ignore builtin

[KO Myung-Hun] Begin porting mksh to OS/2

[komh, tg] Some generic minor bugfixes from OS/2 porting

[tg] Document mknod(8) isn’t normally part of mksh(1)

[tg] Quote arguments to : in build/test scripts as well

in build/test scripts as well [tg] Add cat(1) hack for printf(1)-as-builtin: always prefer external

[tg] Explicitly use binary mode for any and all file I/O in stock mksh

[Ilya Zakharevich] Use termio, not termios(4), on OS/2

[tg] Set edchars to sane BSD defaults if any are NUL

[tg] Implement support for PC scancodes in Vi and Emacs editing mode

[komh] OS/2 uses ‘;’ as PATH separator plus support drive letters

Changes in the current (unreleased) R50-stable branch:

[tg] Correct some mistakes in the manual page

[tg] Fix a bug in the testsuite driver, spotted on EBCDIC systems

R50f is a required security and bugfix release:

[tg] Add a patch marker for vendor patch versioning to mksh.1

[tg] SECURITY: make unset HISTFILE actually work

actually work [tg] Document some more issues with the current history code

[tg] Remove some unused code

[tg] RCSID-only sync with OpenBSD, for bogus and irrelevant changes

[tg] Also disable field splitting for alias 'local=\typeset'

[tg] Fix read -n-1 to not be identical to read -N-1

to not be identical to [tg] Several fixes and improvements to lksh(1) and mksh(1) manpages

[tg] More code (int → size_t), comment and testsuite fixes

[tg] Make dot.mkshrc more robust (LP#1441853)

more robust (LP#1441853) [tg] Fix issues with IFS='\' read , found by edualbus

, found by edualbus [enh, tg] Fix integer overflows related to file descriptor parsing, found by Pawel Wylecial (LP#1440685); reduce memory usage for I/O redirs

[tg] Document in the manpage how to set ±U according to the current locale settings via LANG/LC_* parameters (cf. Debian #782225)

according to the current locale settings via LANG/LC_* parameters (cf. Debian #782225) [igli, tg] Some code cleanup and restructuring

[tg, oksh] Handle number parsing and storing more carefully

R50e is a required bugfix release:

[tg] Add more tests detailing behaviour difference from GNU bash

[tg] Introduce a memory leak for x=<< fixing use of freed memory instead, bug tracked as LP#1380389 still live

fixing use of freed memory instead, bug tracked as LP#1380389 still live [tg] Add x+=<< parallel to x=<<

parallel to [tg, ormaaj, jilles] POSIX “command” loses builtin special-ness

[tg] Fix LP#1381965 and LP#1381993 (more field splitting)

[jilles] Update location of FreeBSD testsuite for test(1)

[Martin Natano] Remove dead NULL elements from Emacs keybindings

[tg, Stéphane Chazelas, Geoff Clare] Change several testcases for $*/$@ expansion with/without quotes to expected-fail, with even more to come ☹

[tg] Fix miscalculating required memory for encoding the double-quoted parts of a here document or here string delimiter, leading to a buffer overflow; discovered by zacts from IRC

[RT] Rename a function conflicting with a MacRelix system header

[tg] Use size_t (and ssize_t ) consistently, stop using ptrdiff_t ; fixes some arithmetics and S/390 bugs

(and ) consistently, stop using ; fixes some arithmetics and S/390 bugs [tg] Remove old workarounds for Clang 3.2 scan-build

[tg] Remove all Clang/Coverity assertions, making room for new checks

[tg] Fix NSIG generation on Debian sid gcc-snapshot

generation on Debian sid gcc-snapshot [tg] Make a testcase not fail in a corner case

[tg] Fix issues detected by GCC’s new sanitisers: data type of a value to be shifted constantly must be unsigned (what not, in C…); shebang check array accesses are always unsigned char

(what not, in C…); shebang check array accesses are always [tg] Be even more explicit wrt. POSIX in the manpage

[tg] Fix shebang / file magic decoding

[tg] More int → bool conversion

[tg] Let Build.sh be run by GNU bash 1.12.1 (Slackware 1.01)

be run by GNU bash 1.12.1 (Slackware 1.01) [Stéphane Chazelas, tg] Fix here string parsing issue

[tg] Point out more future changes in the manpage

[tg] Call setgid(2), setegid(2), setuid(2) before seteuid(2)

[tg] Fix spurious empty line after ENOENT “whence -v”, found by Ypnose

[tg] Optimise dot.mkshrc and modernise it a bit

and modernise it a bit [tg] Use MAXPATHLEN from <sys/param.h> for PATH_MAX fallback

[tg] Some code cleanup and warnings fixes

[tg] Add options -a argv0 and -c to exec

and to [jsg] Prevent use-after-free when hitting multiple errors unwinding

[tg] Fix use of $* and $@ in scalar context: within [[ … ]] and after case (spotted by Stéphane Chazelas) and in here documents (spotted by tg@); fix here document expansion

and in scalar context: within and after (spotted by Stéphane Chazelas) and in here documents (spotted by tg@); fix here document expansion [tg] Unbreak when $@ shares double quotes with others

shares double quotes with others [tg] Fix set -x in PS4 expansion infinite loop

R50d is a required bugfix release:

[Goodbox] Fix NULL pointer dereference on “unset x; nameref x”

[tg] Fix severe regression in field splitting (LP#1378208)

[tg] Add a warning about not using tainted user input (including from the environ(7)ment) in arithmetics, until Stéphane writes it up nicely

R50c is a security fix release:

[tg] Know more rare signals when generating sys_signame[] replacement

[tg] OpenBSD sync (mostly RCSID only)

[tg] Document HISTSIZE limit; found by luigi_345 on IRC

[zacts] Fix link to Debian .mkshrc

[tg] Cease exporting $RANDOM (Debian #760857)

[tg] Fix C99 compatibility

[tg] Work around klibc bug causing a coredump (Debian #763842)

[tg] Use issetugid(2) as additional check if we are FPRIVILEGED

[tg] SECURITY: do not permit += from environment

[tg] Fix more field splitting bugs reported by Stephane Chazelas and mikeserv; document current status wrt. ambiguous ones as testcases too

R50b is a recommended bugfix release:

[Ypnose] Fix operator description in the manpage

[tg] Change all mention of “eglibc” to “glibc”, it is merged back

[Colona] Fix rare infinite loop with invalid UTF-8 in the edit buffer

[tg] Make more clear when a shell is interactive in the manpage

[tg] Document that % is a symmetric remainder operation, and how to get a mathematical modulus from it, in the manpage

is a symmetric remainder operation, and how to get a mathematical modulus from it, in the manpage [tg, Christopher Ferris, Elliott Hughes] Make the cat(1) builtin also interruptible in the write loop, not just in the read loop, and avoid it getting SIGPIPE in the smores function in dot.mkshrc by terminating cat upon user quit

in the function in by terminating cat upon user quit [tg] Make some comments match the code, after jaredy from obsd changed IFS split handling

[tg] Fix some IFS-related mistakes in the manual page

[tg] Document another issue as known-to-fail test IFS-subst-3

[tg] Improve check.pl output in some cases

output in some cases [tg, Jb_boin] Relax overzealous nameref RHS checks

R50 is a recommended bugfix release:

[tg] Fix initial IFS whitespace not being ignored when expanding

[tg] MKSH_BINSHREDUCED no longer mistakenly enables brace expansion

[tg] Explain more clearly Vi input mode limitations in the manpage

[tg] Improve error reporting of the check.pl script (which needs a maintainer since I don’t speak any perl(1), really), for lewellyn

script (which needs a maintainer since I don’t speak any perl(1), really), for lewellyn [tg] Use $TMPDIR in test.sh for scratch space

in for scratch space [tg, Polynomial-C] Check that the scratch space is not mounted noexec

[pekster, jilles, tg] Use termcap(5) names, not terminfo(5) names, in tput(1) examples, for improved portability (e.g. to MidnightBSD)

[tg] Avoid C99 Undefined Behaviour in mirtoconf LFS test (inspired by Debian #742780)

[tg] Fix ${!foo} for when foo is unset

for when is unset [tg] Improve nameref error checking (LP#1277691)

error checking (LP#1277691) [tg] Fix readonly bypass found by Bert Münnich

bypass found by Bert Münnich [Ryan Schmidt] Improved system reporting for Mac OS X

[nDuff] Explain better [[ extglob handling in the manpage

[tg] Remove arr=([index]=value) syntax due to regressions

syntax due to regressions [tg] IFS-split arithmetic expansions as per POSIX 201x

[OpenBSD] Add more detailed Authors section to manpage

[tg] Fix set ±p issue for good: drop privs unless requested

issue for good: drop privs unless requested [tg] Improve signal handling and use a more canonical probing order

[tg] Fix return values $? and ${PIPESTATUS[*]} interaction with set -o pipefail and COMSUBs

and interaction with and COMSUBs [enh] Detect ENOEXEC ELF files and use a less confusing error message

[tg] Update to Unicode 7.0.0

[tg] Shut up valgrind in the $RANDOM code

code [tg] Use -fstack-protector-strong in favour of -fstack-protector-all

[tg] Fix access-after-free crash spotted by Enjolras via IRC

R49 is a recommended bugfix release:

[tg] dot.mkshrc : fix two issues with the cd wrapper

: fix two issues with the wrapper [tg] Unbreak set +p (wider issue still to be addressed)

(wider issue still to be addressed) [Steffen Daode Nurpmeso] Use WCONTINUED with waitpid(2)

[millert] Add proper suspend builtin handling tty(4) and setpgrp(2)

[tg] Sanitise and slightly optimise control character handling

[tg] Add O_BINARY to all open(2) calls for OS/2 kLIBC support

to all open(2) calls for OS/2 kLIBC support [tg] Generate option strings for shell, set, ulimit at compile time

[Steffen Daode Nurpmeso] Drop ISTRIP termios(4) mode

[tg] Mention negative history numbers, octals in the manpage

[tg] Make check.pl work with Perl < 5.6.1 again

work with Perl < 5.6.1 again [tg] Detect getsid(2) and skip the oksh suspend builtin otherwise

[tg] Document that set -o noclobber is unsafe for tempfiles

is unsafe for tempfiles [tg] Update to Unicode 6.3.0

[RT] Restore some portability

[tg] Fix parsing positional argument variable names

[tg] Sprinkle a few __attribute__((__pure__)) ; fix warnings

; fix warnings [tg] Fix build on OSX: always use our wcwidth code; only use our strlcpy(3) code if the OE doesn’t provide one (prompted by jonthn on IRC)

[tg] Optimise sh -c to exec even in MKSH_SMALL

[tg] Use new BAFH for hashing

R48b is a minor bugfix update:

[tg] Fix display issue with multi-line prompts and SIGWINCH

R48 is a small but important bugfix update:

[tg] dot.mkshrc : unbreak hd(1) function in UTF-8 mode

: unbreak hd(1) function in UTF-8 mode [Jens Staal, tg] Improve buildability on Plan 9 and support kencc

[tg] Clean up and improve build process and testsuite

[Michael Langguth] Add multi-layer ICO file from mksh/Win32

[tg, Steffen Daode Nurpmeso] Fix interactive shell exiting on ^C or syntax error when the EXIT pseudo-signal trap was set (to anything)

[tg, Daode] Display longer command excerpts in job control

[tg] Rewrite Emacs mode display window sliding calculation code

[tg] dot.mkshrc : “doch” now keeps standard input

: “doch” now keeps standard input [tg] Reduce memory usage and improve comments and documentation

older changes

Future Plans