⚠ This page contains old, outdated, obsolete, … historic or WIP content! No warranties e.g. for correctness!
mksh — old versions
This page lists information about versions of mksh(1) earlier than R40.
Old instructions
Compilation
The build script also honours the following environment variables:
- CC (cc) — the C compiler used
- CFLAGS (-O2 / -xO2) — optimiser and other compiler flags used (set to anything containing a letter or digit to prevent Build.sh from automatically adding optimisation flags)
- CPPFLAGS (no default) — additional cpp(1) flags
- LDFLAGS — additional CCLD flags
- LIBS (-lcrypt on Interix; empty otherwise) — additional libraries to pull in
- NOWARN (-Wno-error / -errwarn=%none) — $CC option to disable bailing out at errors; used during mirtoconf checks
- NROFF (nroff; “nroff -c” with GNU groff) — the manual page processor used unless -r is given
- TARGET_OS (uname -s || uname) — the operating system to compile for; set this during cross compilation; valid: AIX BeOS (not yet) BSD/OS CYGWIN* Darwin DJGPP (not yet) DragonFly FreeBSD GNU (Hurd) GNU/kFreeBSD Haiku HP-UX Interix IRIX* Linux MidnightBSD Minix MirBSD NetBSD OpenBSD OSF1 Plan9 (not yet) PW32* (not yet) QNX SunOS syllable (not yet) ULTRIX UWIN*
- TARGET_OSREV (uname -r) — the operating system revision number for these that need it; currently: QNX (R38c+)
- Feature selectors:
- USE_PRINTF_BUILTIN=1 — add printf.c to the list of files to be compiled and set a flag so it is used as builtin (R39+)
If CPPFLAGS contain any of the following definitions, the resulting binary will be compiled with a specific flavour:
- -DMKSH_ASSUME_UTF8=0 — assume the terminal is not in UTF-8 mode (use together with HAVE_SETLOCALE_CTYPE=0 in the environment
- -DMKSH_ASSUME_UTF8=1 — assume the terminal is in UTF-8 mode (use together with HAVE_SETLOCALE_CTYPE=0 in the environment
- -DMKSH_BINSHPOSIX — include code to automatically “set -o posix” to change functionality if called as sh or -sh (R46+)
- -DMKSH_BINSHREDUCED — include code to automatically “set -o sh” to reduce functionality if called as sh or -sh
- -DMKSH_CLS_STRING — the string to send to the terminal to clear the window (default: "\033[;H\033[J")
- -DMKSH_CONSERVATIVE_FDS — use less filedescriptors (32/10 ipv 56/24), e.g. if the system supports few (mksh R37c, dropped with R53)
- -DMKSH_MIDNIGHTBSD01ASH_COMPAT — parse “--” on the shell command line like MidnightBSD 0.1 /bin/sh (different from all other shells); requires -DMKSH_BINSHREDUCED or “-o sh” (R39b+)
- -DMKSH_NOPWNAM — omit getpwnam(3) calls (~foo/ expansion) in order to not pull in the nsswitch or PAM libraries
- -DMKSH_NO_LIMITS — don’t compile the ulimit code (R38c+ -R59c)
- -DMKSH_SMALL — build a really small mksh(1), e.g. for embedded systems (see below for details of what this entails)
- -DMKSH_S_NOVI=0 — do not omit the Vi editing mode (R39b+)
- -DMKSH_S_NOVI=1 — omit the Vi command line editing mode (" ")
- -DMKSH_UNEMPLOYED — compile without job control (R37b+)
- -DMKSH_DEFAULT_EXECSHELL — default: "/bin/sh" (R40+)
- -DMKSHRC_PATH — default: "~/.mkshrc" (R40+)
- -DMKSH_DEFAULT_TMPDIR — default: "/tmp" (R40+)
- -DMKSH_CLRTOEOL_STRING — default: "\033[K" (R40+ -R53)
- -DMKSH_A4PB — force arc4random_pushb(3) for $RANDOM (R40+)
- -DMKSH_NO_DEPRECATED_WARNING (varies between versions)
- -DMKSH_DONT_EMIT_IDSTRING — for broken OSes (R40+)
- -DMKSH_NOPROSPECTOFWORK — disables more than just job control, to use for tracking down signal handling bugs in Syllable, Plan 9 (R40+)
- -DMKSH_NO_EXTERNAL_CAT — always run cat as builtin, instead of diverting to command cat if called with flags (R40b+ -R51)
- -DUSE_REALLOC_MALLOC=0 — if realloc(NULL, n) is not equivalent to malloc(n) (n > 0) as ANSI C89 prescribes
You can override certain mirtoconf checks by setting environment variables
like HAVE_REVOKE=0 (default for Linux) — if these are set to 0 or 1,
the values are used; if unset, the values are probed (unless overridden by a
different check, such as MKSH_SMALL), if set to ‘x’ the probe is forced.
Useful items to enable/disable are HAVE_MKNOD (set to x to re-enable),
HAVE_SETLOCALE_CTYPE (set to 0 if you know that
it won’t ever return UTF-8), HAVE_PERSISTENT_HISTORY (0 to not include this
feature), HAVE_FLOCK_EX (if flock or mmap do not work on files).
Defining MKSH_SMALL will disable persistent history (to re-enable, env HAVE_PERSISTENT_HISTORY=x), try to compile with -fno-inline, disable the nice(3) extern; (not overridable) implies traditional/conservative filedescriptor usage, MKSH_NOPWNAM; omits shebang checking in scripts, the Vi command line editing mode (mksh R39b and up can re-enable it by defining -DMKSH_S_NOVI=0), certain verbose error messages, the entire ‘-T’ command line option; replaces inlines with separate functions for size over speed optimisation, etc. (In R39b and up, it disables a whole lot more things than in earlier versions.)
Accepted arguments to Build.sh are:
- -combine — all-in-one build, recommended unless gcc is broken; ignored if $CC does not support “-fwhole-program --combine” (gcc4, R37+) — replaced with “-c combine” from mksh R40 — dropped entirely because LTO has proven too unreliable in R58
- -llvm[=…] — compile to bytecode; option arguments (or, if none given, ‘-std-compile-opts’) are passed to LLVM opt (mksh R36b and up) — replaced with “-c llvm” from mksh R40
- -g — append -DDEBUG -g3 -fno-builtin which are required to work around gcc/valgrind and clang/scan-build bugs (R40; R39b+ called it -valgrind) and enable extra consistency checks, Coverity Scan workarounds, wrap some stdlib functions for extra type checks, and in the future add recursion depth limit so fuzzers don’t trip a stack underflow when triggering unlimited recursion
- -d (R29 and below): build dynamically, don't try to link with -static by default on architectures that support it
- -nd (R29 and below): build statically, always try to link with -static even on systems with nsswitch/PAM
- -q (R35b and below): output almost nothing
- -r (all versions): don't try to build a pre-formatted version of the manual page using nroff(1) if found
These special values in CPPFLAGS are recognised:
- -DMKSH_MIDNIGHTBSD01ASH_COMPAT — parse “--” on the shell command line like MidnightBSD 0.1 /bin/sh (different from all other shells); requires -DMKSH_BINSHREDUCED or “-o posix” (R38+) / “-o sh” (R39b+)
- -DMKSH_BINSHREDUCED — include code to automatically “set -o posix” (mksh R39b+: “set -o sh”) to reduce functionality if called as sh or -sh
- -DMKSH_NOVI — omit the Vi command line editing mode, which is orphaned anyway, yet functional (mksh below R39b)
- -DNO_STRTOD — (printf.c) disable floating point (below R40)
- -DMKSH_AFREE_DEBUG — run with extra alloc/free checking (mksh R36b and below)
- -DMKSH_NEED_MKNOD — if MKSH_SMALL is set, do not omit the mknod(8) builtin functionality from the binary; deprecated, use the environment variable HAVE_MKNOD=[0|1] to determine if this builtin should be compiled in or not instead; has been removed past R31c
The build script also honours the following environment variables:
- CPP ($CC -E -) — the C preprocessor used
Other Shells and more
mksh is a successor of pdksh but not affiliated with the pdksh developers or contributors. mksh is not affiliated with the AT&T Korn Shell, its past or present owners, other than that both attempt to implement the Korn Shell programming language.
mksh targets users who desire a compact, fast, reliable, secure shell not cut off modern extensions; a shell with Unicode support; an actively developed, current, and portable product; one with developers that listen to their users’ requests and implement them if they actually make sense.
mksh aims to replace pdksh in all but very rare use cases (such as support for checking the Unix mbox) and in all operating environments (thus including patches from pdksh on e.g. Debian).
Differences
mksh is a direct descendant from the OpenBSD /bin/ksh and contains all of its bug fixes and enhancements except the “GNU bash-like $PS1” and “POSIX character class support in globbing” changes and the incompatible “ulimit can handle multiple limits in one invocation” difference. Some of the more weird diffs in oksh have not been merged either. The DeliLinux developer who is responsible for packaging oksh for GNU/Linux should instead use mksh and port that diff over (be careful to not break the fixes to the command line editing modes, these are subtly broken in OpenBSD). Even better, the OpenBSD people should not only commit a port of mksh but replace their ksh with it (optionally retaining that GNU bash-like $PS1 stuff). The set -o emacs-usemeta command is no longer needed because the emacs editing mode has been changed for Unicode/UTF-8 mode, which adds a new set -o utf8-mode flag. The set -o sh command has been completely removed, set -o posix merely turns off brace expansion as side effect. There is no limit (well, 2³² — for now…) on array sizes any more. Many bugs and security holes have been closed in mksh and are still in oksh and OpenBSD ksh. The user interface has much less bugs and surprises; emacs editing mode is enabled by default. In contrast to oksh, set -o arc4random can be used to control which generator for $RANDOM is used.
mksh is the heir of pdksh and contains all the latest fixes from upstream (so ca. 1995) and Debian. It is the only pdksh derivate currently being under active development. See above for other differences. The code really has been cleaned up and no longer contains any material under licences more restrictive than the BSD licence.
AT&T ksh88 and ksh93 compare to mksh substantially, but share no code; the user interface is slightly different especially for ksh88; many editing commands work (only slightly) differently as well. mksh implements many, but by far not all, ksh93 features, but most ksh88 features. No floating point. All commands of a pipeline are executed in a subshell.
mksh can do many things GNU bash can’t, for example better arrays, the ksh Co-processes, etc. but is much faster and smaller. In contrast to bash, mksh is still being actively developed (bash almost only receives small changes or weird stuff like programmable tab completion). GNU bash’s array initialiser syntax is not yet supported. We don’t aim at being fully bash compatible, but some of the surprises for converts will be removed. Funnily, bash4 now contains some things first introduced in mksh.
The Z shell (zsh) isn’t even remotely ksh compatible in its “emulate ksh” operation mode, and we don’t compare to it.
mksh is mostly bourne shell compatible (but ^ as alias for | is
not supported, like most modern shells). mksh is also POSIX sh compatible.
Some constructs are not supported, for example
((foo; bar) 2>&1 || baz)
which has to be rewritten as
( (foo; bar) 2>&1 || baz)
because ((…)) is shell arithmetics;
brace expansion is turned on by default; etc.
mksh R33 supports more (later versions even more) bash/ksh93/zsh constructs than its antecessors; sometimes, not all cases (e.g. applying string trimming on arrays) are supported, but you probably will not notice that.
Hints and other useful stuff
mksh does not write a history file by default any longer; set the
environment variable HISTFILE in ~/.mkshrc (or the
profile) if you want this. The history file format of mksh (and oksh
and pdksh) differs from that of other shells, so you might want to
use a construct like
case $KSH_VERSION in
*MIRBSD\ KSH*) export HISTFILE=~/.mksh-history ;;
*PD\ KSH*MirOS*) export HISTFILE=~/.oldmksh-history ;;
*PD\ KSH*) export HISTFILE=~/.pdoroksh-history ;;
?*) export HISTFILE=~/.ksh-history ;;
*) export HISTFILE=~/.nonksh-history ;;
esac
to avoid them overwriting each others' history file.
Very old sample: this
OS inclusion:
- Crux GNU/Linux used to have an mksh port contributed by Han Boetes.
For packagers: Upgrades
R47: Overriding size(1) with $SIZE now works. Do take note of this GCC bug when trying to build mksh sticks / waits forever.
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 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.
mksh R39c should fix a bug that could have led to accidental removal of the manpage when building in the source directory. AIX builds no longer uselessly pull in libcrypt.
mksh R39b now has a separate caveat section listing the most relevant user-visible changes, split off this packagers' list. The optional, undesirable, unsupported printf(1) builtin is now documented in the manpage. The chdir builtin is an alias for cd. The realpath builtin is now always provided. MKSH_SMALL removes much more functionality than it used to. MKSH_NOVI=1 is now MKSH_S_NOVI=[0|1]. $RANDOM handling is greatly simplified. There's now both “±o sh” and “±o posix”, and they differ; MKSH_MIDNIGHTBSD01ASH_COMPAT needs the former. New build flags -M, -valgrind. The default on HP-UX on IA64 is no longer to default to building with -mlp64 (gcc) or +DD64 (HP aCC). SUNWcc tries -xipo (but requires the packager to use -xO4 or up manually).
mksh R39 has user-visible changes regarding “set -u” (“set -o nounset”) and alias/function name conflicts regarding whitespace before parenthesēs, as well as a much enhanced dot.mkshrc sample file I urge to install. People using a Makefile to build it may need to regenerate their set of CPPFLAGS used; CPPFLAGS handling in general has improved. There is now a defined but unsupported way to make printf(1) a builtin; this is not tested and adds a huge SLOB of foreign code to the build, lets the shell use stdio and floating point, making it bloated and fragile; if you still want it (hi Md), set USE_PRINTF_BUILTIN=1 and add printf.c from mircvs://src/usr.bin/printf/ to the build.
mksh R38c adds QNX fixes, build system fixes, and the (not recommended) ability to use -DMKSH_ASSUME_UTF8=0 to skip the environment checks for locale (leading to one (supposedly un-)expected regression test failure). Use -DMKSH_NO_LIMITS to skip the ulimit builtin (klibc).
mksh R38b works on QNX 6.4 out of the box.
mksh R38 offers -DMKSH_MIDNIGHTBSD01ASH_COMPAT and users should be warned about the “!string” line and UTF-8 mode changes.
mksh R37c now honours -DMKSH_CONSERVATIVE_FDS and ACK. The regression test suite keeps LOCPATH around.
mksh R37b now honours -DMKSH_UNEMPLOYED for the jobless mode required on, at least, Minix 3.
Freshmeat announcements have ceased because the site switched to a very user-unfriendly HTML (especially Lynx). Use the RSS feed (now defunct, as of 2019) instead.
mksh R37 has a new ‘-combine’ Build.sh option. The -DMKSH_AFREE_DEBUG flag is gone due to a new allocator, which however honours -DUSE_REALLOC_MALLOC=0.
At Freshmeat you can subscribe to get automatically notified (with a summary of changes, not the complete changelog, see below) whenever new releases are put out.
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).
mksh R36b stays compatible, no surprises there. The ‘-llvm’ option to Build.sh, however, is new.
mksh R36’s Build.sh script ‘-q’ option is gone. Furthermore,
you must add -DMKSH_BINSHREDUCED to your CPPFLAGS now
if you want mksh to behave more POSIXish if called as sh.
OSF/1 V2.0 is now supported using the native DEC C compiler.
mksh R35b builds on some more platforms and throws less warnings, but the build system is almost unchanged; test.sh now shows the Perl binary used (honours $PERL) and its version.
In mksh R35, setlocale/nl_langinfo have been disabled by default for
some platforms. If we do not assume UTF-8, disabling lets mksh employ
the LANG and LC_* environment variables for codeset
determination. Also, a new builtin is included depending on existence
of the readlink(3) function, disabled by default if MKSH_SMALL. The
“pdksh” check category is no longer persistent. The licence has changed
(the advertising clause was removed). The dot.mkshrc sample
was changed to improve re-use.
There was no R34.
No changes in mksh R33c except for Ultrix support. None in R33d.
In mksh R33b, much more compilers are detected, even if not all of them are supported. The OE (OS and CC/LD) versions are now dumped too. Instead of #error, forced link failures are now used as the mechanism to auto-detect some things in the target environment. Features are now much better detected, and some annoying warnings don’t show up any longer due to this. Less tools are required to build.
Please be reminded that you should run ./test.sh -v inside an environment with /dev/tty available (as device node) and usable (e.g. use script(1) or GNU screen if you’re doing auto-builds detached from controlling terminal). Use -v to see failures.
No surprises in mksh R33 either, but the build system now gives more detailed output on the version actually built, to aid tracking down FTBFSen (build errors) with access to only the build logs. Regression tests now work with Intel’s compiler on SLES too, which requires a custom LD_LIBRARY_PATH formerly stripped by the script.
No surprises in mksh R32, but some ancient systems (AIX, Solaris 11, OSF/1, UWIN) are now better supported.
In mksh R31d, parallel make with ‘-j’ was added (no limitation on number of children though), this even works with Solaris 8 /bin/sh. The MKSH_NEED_MKNOD define is no longer honoured.
From mksh R31 to R31b, arc4random.c has been upgraded.
From mksh R30 to R31, there are no surprises. The “arc4random.c” file is available from mircvs://contrib/code/Snippets/arc4random.c now, and the new “source” command is not available in posix mode either.
From mksh R29 to R30, the following things should be kept in mind:
The syntax of Build.sh has changed: $CC now defaults to “cc” instead of “gcc”, and the ‘-d’ and ‘-nd’ arguments are gone — if you want to build a statically linked mksh, pass LDSTATIC=-static (gcc+GNU ld, adjust for other OEs) to it. An “arc4random.c” is now automatically included into the build if found in the source directory. The $CPP variable is ignored, $CC -E is used instead, except for tcc, which uses “cpp -D__TINYC__” because “tcc -E” doesn’t work.
As a tribute to better POSIX compatibility, certain aliases (like “stop”) are no longer predefined in “set -o posix” mode, which is invoked automatically if the shell is run as -sh, /bin/sh or similar, so that they can be used as function names.
If defining MKSH_SMALL, the ‘vi’ editing mode is omitted, which may surprise your users.
Many compilers other than gcc are now supported as well as AIX.
Users' Upgrade Caveat
R47: The -T option no longer chown(2)s or chmod(2)s the tty(4) device; it no longer fork(2)s if the argument is prefixed with a ‘!’ (MirBSD setsid(2) is a bit too anal to make use of it, but it gets rid of cttyhack et al. on Linux). POSIX compatibility was improved again (also thanks to the OpenBSD guys). New “set ±o inherit-xtrace”. Fixes lotsa bugs in R45/R46…
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.
R39c: Evaluation of things like ${foo:-bar} and "${foo+bar}" now behave standards-compliant (SUSv4) and more like all other shells, sans bugs. In particular, if a ${} expression is double-quoted, the apostrophe/single quote loses its special meaning within, whereas it still acts as quote character if the expression is not double quoted. Other special characters' meanings have been updated to match standardised/expected behaviour.
R39b: Due to a lot of bugfixes and some enhancements, take care when upgrading. The realpath builtin is now always available. There are now both “±o sh” and “±o posix”, and they differ (scroll down to almost the end of the R39b changelog). In numeric expressions, “'a'” is an alternative to “1#a” like in ksh93; “$'…'” expanded strings are now also supported. Some constructs parse more loosely, and things like “function stop () {” work now. MKSH_SMALL removes much more functionality than it used to. set +o arc4random is no longer possible (either it's there and used, or it's not). "mksh /tmp/horsies" now exits 127 ipv 1 (ENOENT). 「((foo) || bar)」 and 「((foo) | (bar))」 work now. Lazy evaluation of ternary operations is fixed. In '-o sh' mode, echo does not expand backslashes any more. In '+o sh' mode, “set -- $(false)” POSIXly correctly returns 0 (and breaks getopt(1) in traditional usage mode). Changes of variables inside Bourne style functions affect the caller's environment. “eval $(false)” also returns 0. “±U” is now honoured on an interactive shell's command line. Finally, the getopts builtin now behaves standards-compliant: even on an unknown option, OPTIND is incremented (think “getopts "ab:c" ch” and “script -a -I foo bar” in contrast to “script -a -- -I foo bar” — mkdep(1) was affected, as will be every script that does not abort in the (\?) or (*) case).
mksh R39 has user-visible changes regarding “set -u” (“set -o nounset”) and alias/function name conflicts regarding whitespace before parenthesēs.
Recent Changes
R47 is a bugfix everyone must upgrade to:
- [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
- [tg] Prevent recursion loops for namerefs; found by ormaaj
- [tg] Replace wcwidth code by mine based on Unicode 6.2.0
- [tg, Alexander Polakov] Fix quoting in word part of ${var+word} etc. when the expression is in a quoted brace or a here document
- [tg] Fix some compiler warnings; improve sig{,handler}_t detection
- [tg] Keep SIGCHLD blocked in some more semi-critical code paths
- [tg] Fix uninitialised variable causing random nōn-numerical input to be accepted and acted upon in the select built-in command
- [tg] No longer chown(2)/chmod(2) the -T tty(4) argument
- [tg] Don’t fork(2) if the -T tty(4) argument begins with ‘!’; eliminates the need for things like oneit_line/cttyhack/etc. on Linux
- [jca] Fix “for var in; do” to not be interpreted as “for var; do”
- [tg] Use %zu for printing size_t (ipv %lu with casting around)
- [tg] use ${SIZE-size} for lewellyn’s cross
- [fgsch, espie, millert, tg] Write more testcases
- [millert] POSIX specifies that for && and || lists, only the exit status of the last command matters for “set -e”; fix and document
- [millert] check.pl: Add -T flag to set the tmpdir; use mkstemp(3) and mkdtemp(3) instead of $$ in /tmp for tempfiles
- [jca] Make $(<nonexistent) behave like $(cat nonexistent)
- [tg] Let shf_open return an errno; display why file wasn’t read
- [tg] Finally decide on regression-39 desired outcome (sync with AT&T ksh93 and GNU bash --posix as well as mksh behaviour)
- [tg] Fix post{in,de}crement in not evaluated side of e.g. ternary operator (LP#1187729)
- [tg] Fix “set -x” problems; add “set +o inherit-xtrace” (LP#1179287)
- [tg] Simplify some code
- [tg] Fix segfault related to mixing funsub/valsub and comsub
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 programs 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
mksh R39c is an important minor bugfix release:
- [tg] Build system, code, docs and testsuite cleanup, also style(9)
- [tg] Build.sh now requires people to whitelist conftest*.c
- [tg] AIX builds no longer pull in libcrypt uselessly by default
- [tg] Parse and evaluate ${parameter op word} correctly
- [tg] Fix possible SIGSEGV in interactive mode bind builtin due to mis-optimisation of gcc combined with a bogus prototype; discovered by Grml.org's Frank Terbeck (ft), thanks!
- [tg] Prevent Build.sh from accidentally removing mksh.1
mksh R39b is a major stability and bugfix update:
- [tg] Clean up some more strict *roff or compiler warnings: dashes, undefined macros; casting errors (constness, signedness, type width/class) and catch possibly unaligned pointer dereferences early; remove code/rodata redundancies, plug memory leaks
- [smultron] Tweak the manual page: point out the word “colour”
- [tg] Optimise dot.mkshrc DJB’s CDB hash implementations; add Bob Jenkins’ one-at-a-time hash (standard and leading-bit initialised); fix signedness in expressions; let the hashes use stdin if "$*" is empty, like Lb64{en,de}code; use “[[ -o utf8-mode ]]” ipv “[[ $- = *U* ]]”
- [tg] Build.sh portability fixes: missing prerequisite headers; ensure $CC is never called without $CFLAGS; fix test.sh, et al.
- [tg] Optimise internal variable representation; use one-at-a-time hash; cache hash values for faster resizing at zero memory cost; clean up hash table (keytab) code; switch hash table collision resolution algorithm to Python’s; prepare for later changes (commented out)
- [tg] Fix type errors in the source code (int → bool, size_t, mksh_uari_t)
- [tg] Fix “${foo:bar:$baz}” not working (missing substitute() call)
- [tg] Implement “typeset ±a” as nop
- [tg] Support ksh93-like “${!foo[@]}” listing the keys (indicēs) of all set array elements — zsh does it too (${(k)foo}), bash4 can’t :þ
- [tg] Support bash/ksh93-like “array=([key]=value …)” and (additionally) “set ±A array -- [key]=value …” to directly specify indicēs to use
- [tg] Document the optional, unsupported, printf(1) builtin in TFM
- [tg] Replace realpath(3) dependency and internally used get_phys_path() pdksh code with own implementation; always offer the realpath builtin
- [tg] Implement nameref='typeset -n' (bounded variables) like AT&T ksh93 but with mksh-style nested/dynamic scoping and on-use resolving; they cannot currently be stored in an array though
- [tg] Add “chdir” builtin doing the same as the “cd” special builtin
- [tg, David Korn] Document more differences between mksh (and pdksh) and AT&T ksh (or, more specific, ksh88, ksh93) in the manual page
- [tg] Support “'a'” as an alternative to “1#a”, like ksh93 does
- [tg] Add ksh’s “test -o ?foo”: true if “foo” is a valid shell option, where “foo” can be “xtrace” or “-x” or “+x” (these three are equivalent)
- [tg] Support “$'…'” backslash-expanding single-quoted strings, as requested by David G. Korn, with almost the same syntax and semantics
- [tg] Unify backslash expansion code (C style vs. print builtin mode)
- [tg] Support “function stop () {” bashism
- [tg] For several items in the source code that require order to be kept, provide it from multiply-included header files; sort correctly
- [tg] Get rid of unneeded FMONITOR (-m) for shells without job control; sync list of flags, comments and manpage with reality
- [tg] If MKSH_SMALL, reduce size by removing editor functionality
- [tg] Support VT100 emulator style {Ctrl,Alt}-CurLeft/Right keycode sequences with new vt100-hack emacs bind function (LP: #355883)
- [cnuke, tg] Remove more, like GNU bash extensions, from MKSH_SMALL
- [tg] Remove more functionality, such as Emacs command line editing mode bind key macros, and other extensions, from MKSH_SMALL to help floppies
- [tg] Make forking and subshells less expensive wrt. random state
- [tg] Build and source code fixes for / caught by SUNWcc, HP aCC, pcc, DEC ucode cc (MIPS), GCC, LLVM clang
- [tg] Make undef/def MKSH_NOVI into 0/1 MKSH_S_NOVI build flag
- [tg] Get rid of "U getenv" in nm(1) output, we already import environ
- [tg] Simplify $RANDOM handling: reads are now either arc4random(3) (if available: set +o arc4random is no longer possible) or an LCG; writes are arc4random_pushb(3) if available for explicit writes, arc4random_addrandom(3) otherwise, or another one-at-a-time hash feeding the LCG; furthermore, RANDOM is now always exported to and imported from (implicit read: no push to kernel done) the environment vector on startup and spawning
- [tg] Internal code cleanup, optimisation, moves to different files; dead/commented out code removal; code beautification
- [tg] Document mksh does not exactly use OPTU-8/OPTU-16 in the manpage, as well as when characters, octets, or screen columns are used
- [tg] Fix exit 127 on "mksh /tmp/horsies" ipv of 1 on ENOENT, #548744
- [Clint Adams] Fix typos in the testsuite
- [tg, Clint Adams] Begin a shared testsuite for mksh and posh
- [tg] Make 「((foo) || bar)」 and 「((foo) | (bar))」 work
- [tg] Fix lazy evaluation of assignments by ternary operator, #445651
- [tg] Work around Cygwin bugs (quirks) hindering the testsuite
- [tg] In FSH mode, “echo [-n] 'foo\x40bar'” shall not be expanded
- [tg] Let Build.sh run with AIX bsh (SVR3 Bourne Shell)
- [tg] Let set -- $(false); echo $? return 0 (POSIXly correct) in FSH mode, 1 (needed for getopt(1) support) otherwise
- [tg] Changes of variables inside Bourne style POSIX functions indeed affect the current execution environment (of the function caller)
- [tg] Fix getopts behaviour (sync with AT&T ksh93 not ksh88)
- [tg] “eval $(false)” shall return 0 (Debian #550717)
- [tg] Ensure that /* apo'strophes in comments */ work
- [tg] New Build.sh flag -M to not compile but spit out a Makefrag.inc file from the current build environment, such as the (cross)compiler, CFLAGS, LDFLAGS, etc. which then can be sourced by e.g. the Android NDK, or built with make(1) — BSD make and GNU make have been tested, but almost all makes should work if the source and build directories are the same or VPATH is supported at least (use of this option is discouraged)
- [tg] Overhaul and simplify handling of (special) variables
- [tg] Further reduce memory (code/data) and import footprint
- [tg] Use functions without PATH_MAX limit on GNU/Hurd
- [tg] Fix tab completing pathnames containing ‘:’, ‘=’, ‘$’ or ‘`’
- [tg] Support ‘-T <tty>’ even if MKSH_SMALL and fix it
- [tg] Remove "which" alias "whence -p" to allow "which -a" in dot.mkshrc and add more examples, some commented out
- [tg] Fix print_columns() issue with displaying items where characters had differing number of octets and columns, and the off-by-one which had hidden this problem with 2-octet 1-column and 3-octet 2-column chars
- [tg] Beautify the manpage in both AT&T nroff and GNU groff
- [tg] Fix null-expansion of “${x%?}” if $x is unset
- [tg] Make some globbing (${x%?}) operate on characters instead of octets; update manual page to reflect that others still do and remove wording that let people think we’d ever support POSuX character classes
- [tg] New ${%foo} returning width of $foo in screen columns, or -1 if $foo contains an ASCII/latin1/Unicode C0/C1 control character
- [tg] Fix subtle possible portability problem wrt. CHILD_MAX
- [tg] Honour ±U on command line of an interactive shell
- [tg] Fix dead stores and other bugs pointed out by the Clang static analyser; put assertions in places it has false positives (-DDEBUG)
- [tg] Plug uninitialised memory access and possible out-of-bounds read of a buffer caught by Valgrind; change one memcpy(3) to memmove(3) where srcbuf and dstbuf overlap; place (-DDEBUG) workaround for false positive
- [tg] HP aCC: change IA64 default from forced +DD64 to using the default; support Bundled compiler; fix double-const warning
- [tg] Rework __attribute__ compiler capability check
- [tg] Apply errno save/restore related fix from (sync with) oksh
- [tg] Build.sh: output message when switching from autoconfiguration to building / output generation (requested by Matt “lewellyn” Lewandowsky); use “conftest.c” ipv “scn.c” (to please ccache); check for “-xipo” with SUNWcc (suggested by lewellyn as well)
- [tg] Allow “unset foo[*]” (keep attributes) and “typeset foo[*]” (for forward-compatibility; in R39b it’s the same as “typeset foo”)
- [tg] When persistent history is enabled (but not MKSH_SMALL) and used, intertwine the shells concurrently accessing $HISTFILE better ⇒ sync on empty or duplicate line as well (requested by Maximilian “mxey” Gaß)
- [tg] Split off “set ±o posix” and “set ±o sh” again, to be somewhat
more compatible to various old or vendor versions of pdksh and mksh:
- MKSH_BINSHREDUCED sets FSH but not FPOSIX
- MKSH_MIDNIGHTBSD01ASH_COMPAT depends on FSH but not FPOSIX
- The echo built-in behaves the same for FPOSIX and FSH
- File descriptors > 2 are not closed for both FPOSIX and FSH
- Both “set -o posix” and “set -o sh” call “set +o braceexpand”
- In contrast to R39 and below, the errorlevel of “set -- $(getopt ab:c "$@")” is now the same in ksh and FPOSIX mode (0) and only FSH will use the errorlevel of getopt (used to be the other way round)
- [tg] Document some more shortcomings in the mksh(1) manual page
- Contributed printf.c fixes:
- [tg] Make printf(1) builtin use “$'…'” mode, like ksh93
- [tg] Fix const-cleanliness
- Contributed arc4random.c fixes:
- [tg] Fix buffer overflows in the Win32 codepath of the contributed arc4random.c file and limit the rate of expensive CryptGenRandom calls if we have other (seed in registry key) entropy pools
- [tg] Fix uninitialised memory access caught by Valgrind
- [tg] New Build.sh flag -valgrind since I’m lazy
mksh R39 evolved into these through various means:
- [tg] Shut up a bogus gcc warning during configuration process
- [tg] Spell AT&T consistently in the source code
- [tg] Tweak mksh(1) manual page, from wbx@ and «lewellyn:#ksh»
- [tg] dot.mkshrc: fix $@ vs. $* mix-up
- [tg] dot.mkshrc: add DJB cdb hash function
- [tg] Sync with oksh: fix Vi editing mode word erase handling, again
- [tg] Skip whitespace between POSIX style shell function name and its definition parenthesēs during detection if an alias of the same name already exists to be more robust (Debian #535970)
- [tg] Build system improvements for ACK and nwcc, both on Debian sid
- [tg] Fix spelling error in changelog discovered by Lintian
- [tg] Aligh “set -o nounset” / “set -u” behaviour with future POSIX standard, as discussed with GNU bash maintainers, David Korn from AT&T ksh93, and The Open Group; prompted by use in Debian; Debian #539538
- [tg] add an unsupported way to make printf(1) a builtin
- [tg] Build system and regression test code and comment improvements: better and more comments matching reality better; more reliability w.r.t. passed CPPFLAGS; more of the MKSH_SMALL changes may be overridden, all of them are now enumerated on the webpage; fixed some breakage; portability
- [tg] MKSH_NOPWNAM and MKSH_SMALL will now both disable the ~fac/ (homedir) expansion code wholly if defined, not just getpwnam(3) calls
- [tg] shells without job control no longer define the standard “stop” and “suspend” aliases (they are pointless anyway); regression tests know
- [tg] use system RCS ID macros on MirBSD if decent enough
- [tg] shut up bogus gcc 4.5/trunk warnings caused by over-optimisation
- [tg] restore ANSI C compilability broken in R38 (speed up, even)
- [tg] use memcpy(3) ipv strlcpy(3) if possible and safe and secure
mksh R38c contains the following fixes:
- [tg] Fix regression tests on OSes insisting on a shebang (Cygwin)
- [Sean Boudreau] QNX 6.4.2 ed(1) is said to have the bugs fixed
- [tg] Build.sh bugfixes: -DMKSH_BINSHREDUCED can also be given without -DMKSH_SMALL; allow HAVE_REALPATH=x and HAVE_REVOKE=x in the environment to re-enable these even if -DMKSH_SMALL disables them by default, like mknod already did
- [tg] -DMKSH_ASSUME_UTF8=0 skips the environment checks, like -DMKSH_ASSUME_UTF8=1, but disables the utf8-mode
- [tg] Apply some more KNF — style(9) — to the source; clean it up and further optimise for small size
- [OpenBSD] Fix segfaults caused by missing check for end of input in the tokeniser on “let --” and other input
- [OpenBSD] Make Vi editing mode ^W behave like Emacs mode’s
- [tg] If no killpg(3) is available, use kill(2) and hope it works
- [tg] -DMKSH_NO_LIMITS skips trying to build the ulimit code
mksh R38b fixes the following problems:
- [André Wösten] Add __NO_EXT_QNX to avoid picking up the wrong waitfor() from <libutil.h> in (while porting to) QNX 6.4
- [tg] Plug memory corruption issue introduced in R38
- [tg] Amend dot.mkshrc with a base64 en-/decoder in shell
- [tg] Import a manpage fix via OpenBSD from Alan R. S. Bueno
mksh R38 comes with these changes and fixes applied:
- [tg] Improve regression test output debugging
- [tg] Fix <libutil.h> prerequisites on MidnightBSD in mirtoconf
- [tg] Mention that RedHat BZ#496791 cannot currently be fixed in the manpage by discouraging use of apostrophes in comments in comsubs; add appropriate (expected-fail) regression tests
- [tg] Sync with OpenBSD ksh (mostly a no-op)
- [James Butler] Add search-history-up and search-history-down keybindings (tcsh-like) to the Emacs command line editing mode
- [tg] Bind new search-history-{up,down} to ANSI PgUp and PgDn keys
- [tg] Document ANSI default keybindings (↑↓←→ Home End Del PgUp PgDn) in the mksh(1) manual page as well
- [tg] Optimise internal UTF-8 handling code for size and reusability
- [tg] Incompatible change: ${foo:1:2} and ${#foo} now operate on characters, not on bytes. Characters are octets (set +U) or (utf8-mode) MirOS OPTU-8 multibyte characters (set -U)
- [tg] Improve regression tests relating to ${foo:1:2} and ${#foo} and let wc=1#x and utf8-mode
- [tg] Use per-file copyright notices, move global text to manpage
- [tg] Expose new MKSH_MIDNIGHTBSD01ASH_COMPAT ifdef; change it to only trigger if FPOSIX (or MKSH_BINSHREDUCED and /bin/sh)
- [tg] Remove already-dead “#if 0” style debugging code
- [tg] Change some code into a more portable fashion, optimise
- [tg] Allow [[ $foo ]] (ksh93 extension) mentioned by pgas
- [tg] Clean up mksh and the contributed arc4random.c for some conversion, enum and other warnings for gcc-snapshot trunk r147610
- [tg] Ensure no function uses more than 768 bytes of stack either
- [tg, wbx] Add extension to make “!string” lines work like in GNU bash
mksh R37c provides these follow-up fixes:
- [tg] Improve præprocessor detection/work in Build.sh
- [tg] Decouple MKSH_CONSERVATIVE_FDS from MKSH_SMALL
- [tg] Enable MKSH_CONSERVATIVE_FDS by default on Minix 3
- [tg] Work around the (in-)famous ACK "const" bug
- [tg] Optimise structure alignment and padding; Debian #522778
- [tg] Retain LOCPATH (for glibc locale) in check.pl
- [tg] Document, simplify and clean up the code better
- [tg] Use mirbsd.org eMail addresses consistently
mksh R37b comes with the following fixes on top:
- [tg] Clean up build system and dot.mkshrc some more
- [tg] Add getrusage(2) implementation using times(3) if none found
- [tg] Add jobless mode (for Minix 3, Plan 9, …)
- [tg] Detect the Amsterdam Compiler Kit in the build system
- [tg] If no RLIM_INFINITY don’t try to do ulimit
- [tg] Work around gcc4 strict warnings vs. broken system headers
- [tg] Work around systems with mmap(2) but no munmap(2)
- [tg] Fix (disallow) bind key macro recursion (instead of beeping and going into an endless loop), allow multi-line bind key macros (mostly from Alexander Hall), remove dead code (the beeping) and optimise
- [tg] Add (commented out, undesired, standards compliance breaking) compatibility code to MidnightBSD 0.1 /bin/sh for ctriv
- [tg] Clarify the mksh(1) manual page even more
- [tg] Port to Minix 3 + GCC
mksh R37 has major standards compliance improvements:
- [tg] Rename -o utf8-hack to -o utf8-mode
- [tg] Fix spacing mode error (pasto) in the mdoc(7) format manpage
- [tg] Implement $((#…)) unsigned arithmetic calculation, needed for arc4random_uniform(3)-in-korn-shell implementation
- [tg] Really preserve LD_LIBRARY_PATH in check.pl
- [tg] New Build.sh option ‘-combine’ for building mksh(1) at once with “-fwhole-program --combine” (gcc4, llvm-gcc4) if available
- [tg] Always set COLUMNS and LINES trying as hard as we can, using TIOCGWINSZ even if used without FTALKING, and with the sane 80x24 default if the ioctl(2) fails
- [tg] Handle _POSIX_VDISABLE being undefined (e.g. Linux/klibc)
- [tg] <sys/file.h> is only required for flock(2)
- [tg] Fix multi-column output routine for the corner case if the screen is less wide than one output column; 10x Gábor Gergely
- [tg] Fix ${foo/@(%)/\\x} in UTF-8 mode (utf_widthadj for control characters U+0080‥U+009F is slightly broken; this fix shifts the brokenness into the command line editing mode only)
- [tg] Introduce mksh_ari_t and mksh_uari_t internal types to limit arithmetics to 32 bit on all systems; currently depending on the already-used standard int32_t and uint32_t types. Future expansion to 64 bit possible. Document that shell integer variables use this type.
- [tg] The variables PGRP, PPID, RANDOM and USER_ID are now unsigned
- [tg] Fix two off-by-ones breaking PS1 ending with a newline; bug reported by Matthias Diener
- [tg] Just pass through C1 control characters for now
- [tg] Code and internal interfaces cleanup
- [tg] Regression test fixes for Cygwin env(1) being unsorted
- [tg] Replace the memory allocator by something equally simple and homegrown but optimised for use with mksh and free checking
- [tg] Import a couple of minor fixes (e.g. spelling) from oksh
- [tg] Fix problems with "set -e" for real; from oksh, Debian #518359
- [tg] In "set -o posix" mode, have limited echo(1) to improve standards compliance; the exact feature set is open for discussion, e.g. with pkgsrc® people; for now, only -n as first arg
- [tg] Make test builtin operator precedence consistent; from oksh
- [tg] Revamp and fold and enhance the regression tests
- [tg] Document somewhat surprising behaviour in mksh(1) better; here: [ x -eq y ]; for gps23 from #ksh
- [tg] Reduce memory consumption by allocator simplification
- [tg] Fix bugs spotted by DEC ucode cc (ULTRIX) and gcc 1.42 (BSD/OS)
- [laffer1] Make mksh the default /bin/sh in MidnightBSD
mksh R36b is a compatible, major bug-fix update:
- [tg] Add check for naming the output file “scn” instead of “a.out” or “a.exe” when compiling scn.c, for Haiku, from Adam “replaced” Hoka
- [tg] Rewrite utf_backch macro and x_bs2 function into a combined x_bs3 function for the Emacs editing mode, to optimise them and get rid of the use of __typeof__ (suggested by Anders “ragge” Magnusson after the problem was spot by replaced) and one of the uses of the statements-as-expressions feature
- [ahoka] Add mirtoconf check for nice(3), missing on Haiku
- [tg] Remove all uses of the statements-as-expressions feature by rewriting the source code accordingly and optimising some parts
- [tg] Recognise nwcc (Nils Weller’s C compiler) in Build.sh
- [tg] If <strings.h> exists, pull it in for strcasecmp(3)
- [tg] Welcome QNX/Neutrino; work around broken /bin/ed
- [tg] Simplify, shorten, speed up PS1 in dot.mkshrc
- [tg] Remove some dead code courtesy of scan-build native runs
- [tg] Add some casts to prevent LLVM+Clang warnings
- [tg] Work around llvm-gcc-4.2.1 -Wformat pickyness
- [tg] Add new Build.sh option ‘-llvm’ (clang, llvm-gcc)
- [tg] Speed up mirtoconf if ‘-DMKSH_ASSUME_UTF8’ is set
- [tg] Add the workaround for Debian #492377 into the main mirtoconf function (hiding gcc errors during the configure phase) because Gentoo has similar scanner issues; reported by Hanno Böck
- [tg] If an MKSH_SMALL has arc4random(3), skip the rand(3)/srand(3) fall-back altogether to shrink size, also removed need for time(3)
- [tg] Fix alias expansion recursion check if the word to be expanded is immediately followed by end of input, add test case; spotted by Michael Hlavinka in pdksh and mksh; RedHat #474115
- [tg] Fix string/wdstring confusion preventing bashiop (&>foo) to work inside a function, add regression test, limit to 99 fds
- [tg] change regression tests to set -U or set +U instead of set -o utf8-{hack,mode}, as well as query using $- ipv $(set +o) (easier and more reliable)
- [tg] Add comment to regression tests which can fail on slow machines or Cygwin environments due to timing issues
- [tg] Remove a lot of superfluous casts, improve type cleanliness
- [tg] Insert a couple of /* CONSTCOND */ for lint
mksh R36 features the following changes:
- Fix Build.sh invocation without ‘-r’, 10x Elias Pipping
- Mention the MirOS OPTU-8 and MirOS OPTU-16 encodings in the manual page, now that we have a name for it
- In the MirOS base installation via Makefile (and not via Build.sh, run with -DMKSH_AFREE_DEBUG (unless ramdisc or MirOS-stable or formal release, i.e. DEBUGLIBS is not set)
- Merge final version of jaredy’s fix for the stack-storage free issue
- Be more efficient in the mksh(1) manual page example section
- Fix multi-line $PS1 in the (officially orphaned and unsupported) “vi” command-line editing mode (regression; reported by asarch via IRC)
- Fix multi-line $PS1 where the last line is too long for the edit area to fit on the screen, genuine (pdksh, probably) bug, while here
- Plug a memory leak; patch from jaredy taken via oksh
- Fix mis-information re. -o posix mode in the manual page
- If -o posix is set, do not keep file descriptors created via I/O redirection, as Korn Shells do, private; add regression test; Debian Debian #499139; reported by Markus Schaber and Agustin Martin Domingo
- Work around GNU getopt(3) violating every single standard in existence regarding flag placement on the command line (test suite), from Debian
- Sync internal wcwidth(3) implementation with Markus Kuhn’s latest
- Optimise internal multibyte⇐⇒wide character conversion functions
- Emacs editing mode: if the input line is modified (after a history search) or newly typed or empty, preserve it when scrolling the history, requested by many (at least: gecko2, Matthias Diener, Benny, myself)
- Do not push lines beginning with an IFS character or IFS white space into the history (at the PS1 prompt only), for Matthias Diener
- Emacs editing mode: if an Escape character ends a history search, and Escape is bound to prefix-1, and the following character in prefix-1 mode is a prefix-1 or prefix-2 key, do not swallow the Escape character
- Emacs editing mode: new command “edit-line”, bound to ^Xe by default like in lynx(1), allows for interactive editing of the current input line similar to Vi mode “v” command, requested by asarch in IRC
- Build.sh: remove the problematic ‘-q’ option
- Fix internal type abuse: convert more int to bool
- Ignore duplicates when pushing interactive lines into the history, prodded by Matthias Diener, wanted by myself for quite a while
- Ignore duplicates after fc -s editing too, fix regress test
- <libutil.h> needs <sys/types.h> on some platforms
- Implement somewhat different behaviour for repeated invocations of the Emacs prev-hist-word editing command, so that even a single invocation trashes “the mark”, but repeated invocations scroll up the history, similar to what GNU bash attempts and zsh does, by request of Han Boetes
- Improve support for AIX 5.2 / xlC V7.0, from Jupp “cnuke” Söntgen, which does not respect cc -qversion or ld -V (new for improved version reporting on AIX 5.3 / xlC V9.0), but also errors out if a static bounds checker on arrays is triggered by pointer assignment (such as p = arr[sizeof (arr)];, even if the only accesses are of the *--p style, by preventing it from recognising static storage in this case
- Neither AIX has a UTF-8 locale, so disable use of setlocale(3) there
- Fix some of the things the LLVM-Clang scan-build static analyser spotted and a couple of compile time warnings
- Reduce amount of stack space eaten, prefer .bss storage
- Restore old input line on history search abortion
- (unrelated) update arc4random.c sample to allow use of arc4random_pushb(3) on GNU/Cygwin by using Microsoft® CryptoAPI
- Bring back automatic -o posix setting if the shell is invoked as “sh” or “-sh” (unless compiled with MKSH_SMALL), add regression test, change it to be only compiled in with -DMKSH_BINSHREDUCED
- Improve mksh(1) manual page
- Add support for Digital UNIX (DEC OSF/1) V2.0 (MIPS) with DEC C and ucode ld, work around a bug by conditionally using static linking
- Change Build.sh slightly to accommodate for “true Bourne shells” such as OSF/1 V2.0’s /bin/sh in printf(1) detection
- Improve OS / compiler / linker version reporting
- Optimise the code and Build.sh slightly
- (unrelated) fix arc4random.c sample missing defns
- Use the Unicode MirOS Licence template proper in copyright
mksh R35b comes with the following bug fixes:
- IRIX also has no UTF-8 locale at all, confirmed by Elias Pipping
- Fix regression test suite for MKSH_SMALL
- Bring in latest changes from oksh (OpenBSD ksh, not DeliLinux crap)
- Fix abuse and unsafe use of str_save() and str_nsave()
- Optimise the implementations of str_save() and str_nsave()
- If MKSH_AFREE_DEBUG is defined, guard against afree()ing a pointer which has not been allocated from the given pool, from Todd C. Miller
- Fix attempt to free a pointer to stack (function-local) storage when redefining a function containing a call to the “time” built-in, discovered by Elias Pipping, patch by Jared Yanovich, help from Todd C. Miller
- Protect a little against people not running “./test.sh -v” but calling it with, for instance, GNU bash (as homsn did…)
- Honour $PERL environment variable in test.sh, improve scanning for Perl, do not use potentially undefined $^O, print Perl version
- Add <sys/types.h> as <ulimit.h> requirement (dietlibc)
- Work around bug in BSD/OS 3.1 /bin/ksh (PD KSH v5.2.8 96/08/19)
- Add regression tests from OpenBSD’s <bsd.regress.mk> suite
- Use better CPPFLAGS for AIX, Minix 3 (from pdksh)
- Expose the “s ≠ NULL” str_[n]save_() API and use it where the string can never be NULL (local stack storage), from gcc-4.2 warnings
- Clean up pointer-to-integer-cast warnings in the mirtoconf process
mksh R35 comes with helluva changes:
- Simplify and refactor the ulimit builtin, partially from oksh
- Some style cleanup; use appropriate integer types
- Fix a bug in table (e.g. kill -l, tab completion) display: the width of non-ASCII characters is now honoured in the utf8-hack mode
- Improve handling of invalid UTF-8 in certain areas, and multibyte (UTF-8 / CESU-8) in general
- When using “typeset -Z«n»” on an integer variable with a base other than ten, zero-pad the value instead of the base — pdksh, oksh, zsh, and AT&T ksh93 are wrong here; GNU bash doesn’t even have typeset
- Improve parsing of “set +o” output where done (dot.mkshrc, check.t)
- Improve regression tests
- Support for base-1 numbers: in non-utf8-hack mode, ‘1#x’ means the same as the ASCII code for ‘x’ (e.g. 78hex), where ‘x’ is any single octet (byte); in utf8-hack mode, ‘x’ is either a valid and minimalistically encoded UTF-8 multibyte character in the range 0000‥FFFD, or a single octet with no trailing octets (bytes), which will then be converted as if it were an ASCII value, or, if bit7 is set, be mapped into the PUA range of EF80‥EFFF assigned by CSUR for this purpose; this mapping is, in both cases, bidirectional; the planned base-0 number support is not possible with the code, so use base-1 (with utf8-hack disabled, or & 0xFF) instead (while it is recommended to parse only single octets, there is a regression test showing correct and safe multibyte parsing, which however is error-prone to implement and thusly not recommended) — “genial” replaced@TNG, “this sounds fun” ggergely, agreed bsiegert@ and others
- Pull in more current versions of supplied files; use Unicode 5.0
- Clean up unused definitions in build system; document MKSH_CLS_STRING
- Remove advertising clause from copyright file; while we’d be pleased to be mentioned if something contains our code, tg@ will no longer enforce the requirement to advertise with that specific formula, and we’d prefer if people remember the OpenHAL vs ath5k incident and that they cannot simply change licencing of existing code; patches sent to the MirOS Project for inclusion shall be accepted if they’re agreed to match this licence
- Simplify dot.mkshrc sample file: licence is merged into the main copyright file; AT&T ksh93 compatibility was improved
- Fix a display problem regarding fullwidth characters (e.g. CJK)
- Set the “C” locale in Build.sh for tool execution; otherwise, certain OEs behave strange; thanks to Adam “replaced” Hoka for spotting
- Use en_US.utf8 as UTF-8 locale for the testsuite for now
- If setlocale(LC_CTYPE, "") is not available, look at the environment variables ourselves — brings UTF-8 support to poor OSes
- Remove some now-dead code; speed up configuration process; shrink
- Default to no setlocale(3) due to stubbed or missing locale support on GNU/Cygwin, OpenBSD, OSF/1 in Build.sh; a few more that are quite unlikely to have a UTF-8 locale: BSD/OS, Interix, Minix, PW32, Ultrix, AT&T UWIN; default to always UTF-8 on Plan 9
- Fix for testsuite unexpected failure if running as root in one case
- Initialise all shell integer variables (OPTIND, PPID, RANDOM, SECONDS, TMOUT) to base 10
- Reintroduce from mksh pre-R24 shell integer variable PGRP set to the PID of the process group leader via getpgrp(2)
- New shell integer variable USER_ID set to the geteuid(2) and used by dot.mkshrc to speed up logins, saves a spawn of id(1), mentioned by and realisation planned with Andreas "gecko2" Gockel
- Fix dot.mkshrc tilde replacement in both $PS1 and the pushd/popd/dirs implementation when the home directory is empty, the root directory, or ends with a slash (disable replacement in that case)
- Support dietlibc, force it into providing a BSDish caddr_t
- Do not use LDFLAGS and LIBS while compiling with -c
- Add realpath(3) builtin, to further speed up logins and chdirs
- Optimise the code somewhat by making use of possible assumptions
- Set the “C” locale in test.sh as well to quell warnings
- Split the regression tests that use locale between en_US.utf8 and en_US.UTF-8, since not all OSes support either one, and make only HP-UX and GNU use the latter
- Fix kill, mknod(8) builtin usage msg, from Igor Sobrado via oksh
- Use proper ptrdiff_t casts for pointer arithmetics, inspired by an oksh commit from Federico Schwindt
- Remove check category “pdksh” from check.t and test script
- Improve Darwin, OSF/1, HP aCC, SUNpro version reporting
- Support GNU bash “&>” extension, even better than they do, suggested by Lukas “smultron” from MidnightBSD
- Basic support for LLVM+clang in the build system with experimental “ccc” compiler driver; llvm-gcc worked as-is before already
- Better support for contributed arc4random.c file
- Do not spin if unlink(2) fails on $HISTFILE, from Decklin Foster
- Dump the perl(1) $^O variable in test.sh to logs
- Pull in latest changes from oksh
- Allow white space between a here string indicator and the string, accidentally discovered by twkm (#ksh, freenode)
- Allow fd specifications outside the 0‥9 range for I/O redirections, and bounds check them to be lower than the FDBASE definition, currently still 10 if MKSH_SMALL, 24 otherwise (unportable)
- Improve the regression test suite: for one test, we had a bizarre constraint telling it won’t work on UWIN, which was based upon false assumptions, but Tru64 would fail it since its cat(1) unexpectedly outputs some error messages (fix by closing stderr for cat); another test would unexpectedly print no error message on Solaris (fix by making the error message optional in the perlre(1) used)
- Switch back to en_US.UTF-8 for glibc, Debian can do both, Mandriva fails on en_US.utf8 (XXX no libc5 auto-detection to disable it)
mksh R33d is a quick security-update with these changes:
- Move a portability define from sh.h to the setmode.c helper, as it’s only needed there, and we want to use the latter from MirMake as well
- SECURITY: when spawning mksh on a new terminal, for example with sudo mksh -lT/dev/ttyC7, flush all of that tty’s I/O first (CVE-2008-1845)
- dot.mkshrc: ensure “ls” is no alias, don’t hardcode its path
mksh R33c issues fixes for the following issues:
- Handle Ultrix mmap(2) having a different prototype (returning a caddr_t instead of a void * and not defining MAP_FAILED; making Ultrix 4.5 a fully supported platform
- Decrease code size and optimise (using puts-style functions instead of printf-style functions for fixed strings; bool instead of int)
- Correct behaviour of “export”, “export -p”, “readonly”, “readonly -p”, “typeset”, “typeset -p”, “typeset” and their respective descriptions in the manual page; problem reported by Danijel Tasov
- Work around dup2(2) problem (preserving the close-on-exec flag) on Ultrix using code from mirbsdksh-1.11, lost in oksh
- Clean up Build.sh a little more
- Correct quotes and some other stuff in the regression tests; fix for running with old Perl (5.002 or so, Linux 2.0, BSD/OS)
- Export the new “__progname” and “__perlname” environment variables to the suite run from check.t in check.pl
- Do not mistake IBM xlC and VisualAge for different things, thanks to Pascal “loki” Bleser from OpenSuSE for information on them
mksh R33b comes with the following minor fixes:
- Work on porting to Syllable (again much improved; support now en par with Plan 9’s, thanks to Anthony Morphett <awmorp@gmail.com> — maybe the rest is a kernel bug?)
- Fix some minor code issues remarked by MIPSpro
- Port to SGI IRIX 6.5 (uname: IRIX64) using gcc and MIPSpro
- Scan for a lot more compilers; add support for MIPSpro
- Ignore if the OS doesn’t define MAP_FILE for mmap(2)
- Use sys/types.h as sys/mkdev.h dependency
- Enable OSF/1 V2.0 /bin/sh to run Build.sh
- Add strcasecmp(3) proto for Ultrix 4.5 only (imake style)
- Add S_ISLNK if the OS doesn’t define it
- Use tempnam(3) if mkstemp(3) not found — not recommended
- Reduce dependency on certain OE facilities: printf(1), fgrep(1) being able to scan for two patterns at the same time, perl5 being named perl
- New -T- option for dæmonisation, cf. man page
- Port to BSDi BSD/OS 3.1 (gcc 1.42 and gcc 2.7.2.1 supported)
- Simplify the dot.mkshrc file and make it more robust
- Report OE and $CC version in Build.sh, for logs
- Fix look’n’feel of the mksh(1) manual page, so that it still looks best in AT&T nroff(1), looks much better in GNU groff (the PDF version we place on the website), and looks some better and gains the ability to copy’n’paste from it for GNU gnroff -Tutf8, originally prompted by Patrick “aptituz” Schoenfeld and “lintian -viI mksh*.changes”, but then improved (and nroff hacked) by tg@ a lot
- Shut up some gcc warnings (explicit braces; cast MAP_FAILED)
- Try to get rid of the test “if the compiler fails correctly” by using the errorlevel of the $CC process (except with Microsoft Visual C++ which returns non-zero even on success sometimes), thus supporting DEC C on OSF/1 (and, quite possibly, gcc3 on Mac OSX Leopard)
- If revoke(2) and flock(2) are found, check if they’re declared
- Promote Tru64 to a fully supported operating environment, even though it needs a plethora of _*_SOURCE defines and has SIGMAX instead of NSIG; OSF/1 V4.0 and Tru64 (OSF/1 V5.1) are supported with both gcc and HP/Compaq/DEC C in various versions
- Generalise the workaround for incompatible sig_t across the platforms that need it (currently, OSF/1 and PW32)
- Shut up annoying warning about gcc 2.7.2.3, 2.8.1, 2.95.x not knowing the “-std=gnu99” and “-std=c99” options without setting proper errorlevel
A release with many new features is mksh R33, look yourself:
- Sync with OpenBSD ksh (no real functional changes)
- Enhance the print builtin with two new escape sequences: \xAB parses the next up to two hexadecimal digits AB and outputs a raw octet (byte) whose ordinary value is AB; \uABCD parses up to four hexadecimal digits and outputs the UTF-8 (CESU-8) representation of the unicode codepoint U+ABCD from the BMP (Basic Multilingual Plane), not depending on the locale
- The . (“dot”) command (and its counterpart source) needs an argument (the script to source); from Debian pdksh package
- In the lexer, do not expand aliases if there is an opening parenthesis just after the token (from Debian pdksh). This fixes the namespace issue that caused a POSIX function definition stop() { … } to fail due to “stop” being a built-in Korn shell alias. Now, aliases are removed when a POSIX function with the same name is defined; Korn functions are still different: their definition does not fail, but the alias retains its precedence (unchanged behaviour)
- Accordingly, do not disable built-in aliases in POSIX mode any more
- Since POSIX mode now only turns off braceexpand mode (which can then be turned back on), do not handle being called as -sh or sh specially any longer
- Clean up the source code: make some constants private to the only file using it; optimise; comment some code; improve portability with regards to stupid tools in /usr/bin (or /usr/xpg4/bin) and foreign compilers
- Implement “here strings” (like ksh93 or zsh; GNU bash collapses white
space if the string is not double-quoted): you can now replace print
-r -- "$foo" | command with command <<<"$foo" with
the very same semantics as command <<EOF
$foo
EOF (stripping initial tabs is not possible) - Implement string replacement ${var/pattern/string} (where pattern is an extended glob pattern), like GNU bash; like with the substring accessor (${var: x: y}) mksh implements almost all corner cases (and double slash), but do not handle trimming arrays yet
- Side note: You can now, as a consequence of the two items above, write, for instance, x=${x//foo*bar/baz} instead of the more complicated x=$(sed -e 's/foo.*bar/baz/g' <<<"$x") or the mksh R32 and before idiom x=$(print -r -- "$x" | sed -e 's/foo.*bar/baz/g') — be sure to check $KSH_VERSION first though
- Use the new $Mdocdate$ RCS keyword in the manual page mksh(1) as well; since this is not portable in tmac.doc especially to GNU groff, prepend a seven-liner implementing it to the .Dd macro
- Fix a mistake in using the .Nm macro in the manual page
- Make Build.sh and the generated test.sh more chatty about what they’re doing and what versions (aids debugging build logs)
- Update the dot.mkshrc sample and make it more portable; it requires mksh R33 or above now though due to use of special functions
- Enhance the website, especially the section about official testing: now, the tests are split into tests done by us via Makefile (MirOS only), Build.sh (portably), porting frameworks, with arc4random.c added, tests by others via Build.sh, via packaging frameworks, failed tests; more links
- Note: the “vi” editing mode is code of historical value and, at the moment, unmaintained. It does not benefit from the fixes to the “emacs” editing mode (horizontal scrolling) or new features (bind keys that end their sequence with a tilde; UTF-8 support). Neither is it supported in either editing mode to bind keys that generate a sequence consisting of more than just a prefix (ESC, ^X, or ESC [), another octet and (“emacs” only) an optional tilde (but this might come in the future). This is explicitly mentioned here due to a user inquiry.
Sported by mksh R32 are these changes:
- Make checks for symbol declarations compile checks instead of link checks, as the binding may not succeed due to different symbol types, for instance on AIX, if the declaration does not match
- Widen the range of array indices to [0‥2³²-1], with negative values being mapped into the high-bit31 range for simplicity
- Fix the pipeline-as-coprocess internal error
- Do not require certain integer types to be defined any more
- Optimise the code and reduce its RAM usage
Everyone should upgrade to mksh R31d with fixes for…
- Support pcc (the ragge version of the Portable C Compiler)
- Add pushd/popd/dirs functions (csh) and precmd/chpwd hooks (zsh) to dot.mkshrc which now requires readlink(1) with -f; requested by many (e.g. some Gentoo users; XTaran of symlink.ch)
- Enable colour escapes in dot.mkshrc since almost nobody groks how to do it right from the manual
- Remove -DMKSH_NEED_MKNOD checks from Build.sh, people should use the HAVE_MKNOD environment variable
- Implement parallel make in Build.sh
- Fix another busy-loop spinning problem introduced by an icc warning, thanks to spaetzle@freewrt.org for keeping to bug me to look for it, as it affected GNU/Linux most, followed by Solaris, rarely BSD
- Improve standard integer type detection in Build.sh
- Cleanups in code, build script and manual page
The mksh R31c (Solaris-only) upgrade for cnuke@ was caused by:
- Clean up Build.sh and “test … -o …” doesn’t exist in Bourne
- Detect if the non-standard u_int32_t type, which was unfortunately used by the OpenBSD project in designing the standard arc4random(3) API, is present (which it isn’t on Solaris), and, if not, emulate it using the standard uint32_t (ISO C99) from <stdint.h>, which we fake as needed (if the standard integer types are not present, e.g. on PW32 and OSF/1); change mksh as well as the arc4random.c contribution to not use these non-standard types
- Remove unused types from the faked <stdint.h> file
A quick upgrade, mksh R31b with major bug fixes:
- Fix typo (blsk → bksl) in check.t test naming
- Autoscan for uint32_t, u_int etc. presence
- Fix some memory leaks, mostly by NetBSD® via OpenBSD
- The “unset” builtin always returns zero, even if the variable was already unset, as per SUSv3 (reported by Arkadiusz Miskiewicz via pld-linux → oksh)
- In tab-completion, escape the question mark, reminded by cbiere@netbsd.org, via oksh
- Fix a busy-loop problem, Debian #296446 via oksh
- Fix a few display output problems in the build script
- Shut up some gcc warnings on Fedora; beautify some code
- Support OSF/1 with gcc2.8, thanks to Jupp Schugt
- Fix gcc4 detection of __attribute__() on non-SSP targets
mksh R31 was released as part of MirOS #10 with these news:
- Support the TenDRA compiler (possibly also Ten15, not tried)
- Begin supporting Fabrice Bellard’s Tiny C Compiler (tcc on Debian cannot link due to duplicate symbols in GNU libc, thus unfinished)
- Improve some mirtoconf checks (most notably, mknod(2) and macros)
- Add new emacs editing command “clear-screen” (ESC ^L) as requested by D. Adam Karim <archite@midnightbsd.org>
- Support building for MidnightBSD
- Add new shell alias “source”, semantics like the GNU bash builtin
- Add new shell option “set ±o arc4random”, controlling whether rand(3) or arc4random(3) is used for the $RANDOM value, use arc4random_pushb(3)
- Add new builtin “rename” (just calls rename(2) on its arguments)
- Fix the unofficial OpenBSD port, from D. Adam “Archite” Karim, 10x
- Disable the less(1) history file by default (privacy issues) in the sample dot.mkshrc file; mention other things in etc_profile
- Fix a syntax error in Build.sh checking for TenDRA
A milestone in development: mksh R30 can do this:
- Build on and for Solaris, Linux and MirBSD with Sun’s C compiler
- No longer build a statically linked shell by default; do not try, do not provide any means; user has to use LDFLAGS instead
- Remove some probably dead mirtoconf checks
- Remove commented out -fwhole-program --combine check and still active -fno-tree-vrp bug workaround thing, the latter because the bug seems to only appear for functions that also exist as a builtin (which was declared with the nonnull attribute)
- Fix a long-standing typo, 10x moritz@obsd
- Prefer more common signal names (SIGCHLD) over uncommon ones (SIGCLD)
- Quieten gcc and support SUNpro 5.8 on Solaris 10 on sparc64
- Optimise signal handling and detection; enable compilers whose præprocessor doesn’t have -dD to generate list of signals
- Optimise mirtoconf meta-checks for persistent history etc.
- Fix a bug preventing manual page generation on Solaris
- Add support for the Intel® C Compiler and quieten it a little; fix a few minor buglets (mostly type conversion) its too verbose warnings show, as well as some errno ab-/mis-use
- Remove support for honouring the CPP environment variable; $CC -E - is simply used instead in the places where $CPP was used previously, because that was used in other places already, and to prevent it from behaving differently from the $CC used
- If a file called arc4random.c is lying around in the source directory at mirtoconf time, scan for <sys/sysctl.h> and use the file if arc4random(3) isn’t found otherwise. From Debian.
- If the basename of argv[0] starts with “sh”, activate FPOSIX early, preventing some typical ksh aliases from being defined
- If FPOSIX, don’t pre-define aliases (except integer and local) to benefit operating environments that never heard of the great Korn Shell…
- #if defined(MKSH_SMALL) || defined(MKSH_NOVI) disable the vi editing mode
- Don’t try to execute ELF, a.out, COFF, gzip or MZ binaries
- Can be built on HP-UX (PA-RISC and IA64) with gcc or HP C/aC++
- Support x=(a b c) bash-like array initialisation
- Support ${foo:2:3} bash-like substring expansion
- Many mirtoconf improvements, fixes; speed-up; better portability
- Enable compilation using Microsoft C/C++ Standard Compiler
- Add UWIN build target using various compilers with the cc wrapper
- Fix struct padding mistakes uncovered by the Microsoft compiler
- Fix double initialisation / unused value assignment errors unveiled by Borland C++ Builder 5.5
- Fix superfluous code detected by gcc 4.2
- Fix large file support for OSes that require CPPFLAGS contains -D_FILE_OFFSET_BITS=64 — it was detected but not actually used in the build; thanks to hondza for the problem report!
- Give the lexer a bigger state stack if !MKSH_SMALL
- Prepare for addition of make(1)-style search/replace operations; correct the code for other substitution expansion operations
- Default $CC to cc not gcc, this is no non-unix-ware ☺
- Support AIX with gcc and xlC; clean up code to warning-free
- Prefer well-known signal names to alphabetically earlier ones
- Fix a bug delivering ERR and EXIT pseudo-signals to traps combined with “set -e”, thanks Clint Pachl and Otto Moerbeek for the hint
In mksh R29g we MFCd the following changes:
- Some optimisations from above; no longer execute foreign objects
- Improvements in checking for __attribute__, multi-idstring support, signals, types, arc4random.c; disable -fno-tree-vrp and -fwhole-program --combine; correct large file support (still kludgy but no longer buggy)
Please use mksh R29f because of below modifications:
- Fix detection of function prototypes (data declaractions were ok)
- Fix a regression introduced in R29e regarding the scroll bar
- Recommendation on version numbering changed; suffixes b, c, … match .2, .3, … like alphabetical numbering order
Dedicated to David Ramsey and Coverity, mksh R29e unveils:
- Don't poll in strcasestr(3) if setlocale(3) isn't used
- Remove some redundant or unused functions
- Fix a horizontal scrolling on tabcomplete bug, reported by David Ramsey, thanks a lot!
- Fix the utf8bom-3 regression test on MirBSD-current
- Some workarounds around problems found by Coverity Scan, mostly issues with Scan, but the changes help gcc to optimise better
- Fix a null pointer dereference in error path, mis-use of strchr(3) to search for a NUL byte, and two possible out-of-bounds array accesses, found by Coverity Scan, many thanks!
- Optimise dot.mkshrc further
- Fix a cursor mis-positioning on backspace bug, reported by David Ramsey again, thanks!
- Fix a scrollbar mis-display on delete bug, reported by David Ramsey
- Fix a scrollbar mis-display on insertion bug, discovered while fixing the above bug
- Correct displaying of scrollbar on delete, with help from dramsey
Portability improvements in mksh R29d contain:
- Unbreak testsuite on Mac OSX (whose brain-dead filesystem does non-standard Unicode decomposing and normalisation on filenames, thus rendering ANOTHER of our tests unusable *sigh*)
- Port to AIX, thanks to Kurt Telep
- Minor fixes for HP-UX, thanks to HP Testdrive Programme
- size optimisation if utf-8 is assumed to be always on
- Do not scan for and use “-fwhole-program --combine” because it's the cause of at least http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=408850 and breakage with FORTIFY_SOURCE on SuSE; thanks to Pascal Bleser (yaloki), Marcus Rückert (darix), Martin Zobel-Helas, Steve Langasek (vorlon) for tracking this bug down in two different places; Debian #421518
- small manual page fixes
- copy $PATH from Build.sh to test.sh; thanks to a test account on Sun Solaris 11 donated by Julian Wiesener (yofuh) I was able to verify that you want to prefix $PATH with /usr/xpg4/bin because the other tools (/usr/bin, /usr/ccs, et al.) suck major arse…
- Note: the SuSE package in the Buildservice was created by darix (without my knowledge), is maintained by loki now
- Note: the PDF manual page is now PDF 1.3 (Acrobat 4.x) again
Minor bugfixes in mksh R29c — you might want it:
- Regression fix: mksh has some kind of “encoded string” format; use wdcopy() not str_save() to duplicate this; affects formatting of an error message (and below item) only though
- Bugfix: pdksh has an out-of-bounds memory access; the area of code has been touched by OpenBSD developers but the problem not fixed by them; some optimisations turned this (for the error message formatting of the above item) into a memory corruption bug that was only triggering an actual issue on Debian GNU/Linux experimental on IA-64 with some beta version of GNU glibc; add an appropriate bounds check
- Add mirtoconf check for “large file support” needed on some obscure platforms; requested by bsiegert@, idea from GNU autoconf (thanks)
- Add zsh workaround to Build.sh (just to be on the safe side; zsh isn't bourne sh or posix sh compatible, but I didn't find any severe problems with using it to build mksh yet, it's a weird shell though)
- If execve(2) fails with ENOEXEC, try and parse a shebang line ourselves, in case the kernel can do less than we do, unless MKSH_SMALL
- Strip off and ignore an UTF-8 Byte Order Mark (U+FEFF, 0xEF 0xBB 0xBF) at the beginning of input (file, -c option, stdin, interactive, eval) and when processing shebang lines and enable utf8 mode if encountered
- Enhancements to the dot.mkshrc file, whose status (in MirBSD itself) is now upgraded from “sample file for portable mksh to show off to other OSes” to “used as skeleton file in the default installation” — gets us rid of duplicating this stuff in /etc/profile (MirBSD native) a̲n̲d̲ makes sure that users of portable mksh also have the latest goodies
- When doing shebang parsing, accept not only LF and NUL but also CR as markers for end of the (first) line
- If executing fails, tell the user what exactly failed, too
Immediately upgrade to mksh R29b please:
- Bugfix: display UTF-8 control characters (U+0080..U+009F, i.e. everything with a wcwidth(3) of -1) the same as ASCII control characters (U+0001..U+001F), i.e. with a ctrl caret followed by its value XOR U+0040; subsequently treat their width as 2; fix crash (CPU hog in spinning loop) on meta-tab+backspace
- Fix setlocale description in manual page
- in the utf-8 mode, invalid multibytes are now handled more strictly:
- if it's in x_literal() (“quote” / ^V) mode, it's accepted like now
- if it's a mb sequence start, it's rejected with a beep
- if it's a mb continuation, the whole sequence is silently rejected
- remove unused utf_width() macro
- if $CC supports -fstack-protector-all, add it to CFLAGS
- shut up some more gcc 4.1.2 warnings
- if $CC supports -fno-tree-vrp and is subject to the null pointer test optimised away bug, use -fno-tree-vrp to work around it
- in Build.sh, simplify a.out / a.exe (Cygwin) issues
- shrink the manual page to 39 pages sized DIN A4 when built as PS/PDF
- fix a typo in the manual page
Please upgrade to mksh R29 due to the following changes:
- Fix portability of regression tests using fgrep(1), twice
- Fix description of $RANDOM in manual page
- Fix build under OpenSolaris Build 47 (reported in IRC)
- Use easier __RCSID() stuff from MirOS #9-current
- Don't shebang with spaces in test.sh creation
- Remove -fno-strength-reduce from default CFLAGS, the compiler bug was fixed between gcc 2.7.2 and gcc 2.7.2.1…
- Avoid unaligned memory access causing SIGBUS on IA-64 on Debian
- Convert to autoconf-style check for function and header file existence of <sys/param.h>, arc4random(3), arc4random_push(3), setlocale(3) and LC_CTYPE, nl_langinfo(3) and CODESET, getmode(3) and setmode(3), strcasestr(3), and strlcpy(3)
- Add set -o utf8-hack aka mksh -U which changes the Emacs editing mode to an experimental CESU-8 aware multibyte mode (not implemented using wide chars unless internally needed; does not require OS support); check setlocale(LC_CTYPE, "") and nl_langinfo(CODESET) if found to auto-enable utf-8 mode in interactive shells
- Simplify and clean up code; try to remove or replace function calls by smaller equivalents; spot a few non-fatal off-by-one errors
- If Build.sh is called with -DMKSH_SMALL in the CPPFLAGS environment variable, the built-in mknod(8) will not be included, and other functionality and verbose usage messages will be excluded; some macros will be turned into functions to save space and to check if the utf8-hack should be enabled, nl_langinfo(3) is not called. The -T option to mksh(1) and persistent history are not supported.
- Hand-optimise the code to be small, even in the normal build
- Unbreak the -d option to Build.sh
- Check for cc options -Wno-error, -fwhole-program --combine, and (if MKSH_SMALL) -fno-inline and use them if they don't fail
- The autoconf-style (“mirtoconf”) checks have been enhanced, improved and be made more verbose by default
- Rewrite a few functions both to save space and to simplify/unify the code; also spotted a few bugs in existing (inherited) code
- Fix format string mistakes and wrong function and data prototypes
- Correct zero-padding for right-justified strings; add regression test
- EXECSHELL is now ${EXECSHELL:-/bin/sh} again
- Remove duplicate code if feasible; rewrite remaining code to solve all use cases, or use standard library functions such as qsort(3); rework the ctypes and chtypes stuff, get rid of libc/ctype.h
- Change the eaccess() code to not use setreuid(2) and friends, like OpenBSD ksh and apparently pdksh. I'm not too sure about the implications, except that they only affect setuid shell scripts.
- Use setresuid(2) and friends, and setgroups(2) and <grp.h> instead of seteuid(2), setuid(2) etc. on operating systems that support them
- Work around (i.e. remove) all but two -Wcast-qual issues
- Work around a bug in the GNU implementation of the Berkeley mdoc macros which comes with GNU groff (only visible in MirOS with groff -mgdoc, but shows on other operating systems), discovered by crib in IRC
- $RANDOM is always an unsigned 15-bit decimal integer, for all Korn shell derivates; idea from twkm in IRC
- Improve/correct description of typeset command in manpage, and implementation of typeset -p in mksh
- Remove the non-standard emacs-usemeta and vi-show8 shell options, assume the user either has a 7-bit environment, an 8-bit clean terminal, or a UTF-8 environment (preferred), and the dummy sh option
- Build.sh fix for conservative (old) versions of gcc; help Debian
- Compute user-given ulimit value times ulimit unit as an rlim_t value, not as long value; catches some 32 bit overflows on 32 bit platforms due to a missing cast
- Fix some typos in the manual page
- Build.sh add notes for old and non-gcc compilers (TODO)
- Upgrade licence to latest template (revision 1.20)
- Fix reverse logic error in strcasecmp(3) vs strcasestr(3) issue
- Enhance sample ~/.mkshrc
- Prevent segfaults when setlocale(3) or nl_langinfo(3) return NULL
- Use RLIMIT_AS if RLIMIT_VMEM is not found
- Don't expand ~foo/ if MKSH_SMALL, spares getpwnam(3) call
- Fix and autoconfify signal list generation
- Build.sh now uses $TARGET_OS as "uname -s" output for cross builds
- Set flag for regression tests that can't succeed if MKSH_SMALL
- Don't even check for setlocale(3) if MKSH_SMALL, unless overridden by user / build environment
- Scan for C Preprocessor, use $CPP if $CC -E fails
- Fix possible nil pointer dereferences and signal name mismatches
- Scan for __attribute__((...)) and -std=gnu99 (req'd on Solaris 10)
- Correct $LDSTATIC logic, unbreak -d, don't let the user override (or need to) $SRCS, $sigseen
- Simplify TIOCGWINSZ handling, no need to catch SIGWINCH any more; window size changes are processed after input line editing ends (i.e. the lines are entered or ESC # (emacs mode) is pressed) and at startup; ^L (redraw) can't change window size on the fly
- Add -fwrapv to standard CFLAGS, just to be safe, like with when I added -fno-strict-aliasing; this is pending a bug fix in gcc, see PR#30477
- autoconfify compiler flags, c preprocessor
- add option to avoid pulling in getpwnam(3) in !MKSH_SMALL
- scan for certain headers, types; improve portability
- speed up autoconfiguration process in failure case
- finally fix static vs dynamic linking issues
- fix manpage (.Nm macro) glitch with GNU nroff 1.15
- improve auto-detection of which regression tests are valid
- mention failure to revoke(2) is possibly insecure
- if MKSH_SMALL, don't include -T support and don't scan for revoke() function
- new #ifdef MKSH_NEED_MKNOD to embed mknod(8) even if MKSH_SMALL is enabled
- do not scan for revoke() on GNU/Linux since it always fails
- simplify GNU/Linux CPPFLAGS and use them for GNU/HURD and GNU/kFreeBSD (tested on Debian experimental, thanks to the ftbfs.de autobuilder and Michael "azeem" Banck)
- fix the 'bind' (no args) builtin output
- new #ifdef MKSH_ASSUME_UTF8 to not check setlocale() and nl_langinfo(CODESET) if we want to always enable the utf-8 command line editing mode
- tabcomplete a newline to singlequote+newline+singlequote instead of backslash+newline which is eaten; thanks to Thomas E. "TGEN" Spanjaard for noticing
- remove shebang line from check.pl which isn't +x anyway
- fix 'hd' alias in dot.mkshrc example to not run off an ANSI standard 80 column screen; simplify
- integrate MKSH_NEED_MKNOD and MKSH_ASSUME_UTF8 with Build.sh
- Work around Solaris /usr/ucb/tr, Solaris /usr/xpg4/bin/tr, Minix 3 /usr/bin/tr, and SUSv3 deficiencies
- Fix compilation on more platforms (Interix, Cygwin, Linux 2.0 libc5, Debian GNU/kFreeBSD, Debian GNU/HURD, …)
- Use autoconfiguration for persistent history stuff
- Fix the code (add "const" in like 1001 places) to be able to build without -Wno-cast-qual (hope it's safe now)
- Optionally use const-debugging versions of strchr(3), strstr(3), to work around deficiencies in ANSI C
- The above directly led to our own strcasestr(3) implementation for OSes which don't have it
- Optimise dot.mkshrc macros
- Let dot.mkshrc not return failure early
- Remove shadowing warnings for more OSes
- Support old ash(1) versions in Build.sh
- Support use of _NSIG for NSIG
- Optimise ctags(1) generation
Upgrading to mksh R28 with these changes is highly recommended:
- For these who build software as root, the regression testsuite has been adapted to pass when using a priviledgued shell. You have been warned, though. Do not compile software as root.
- Fix some more -Wchar-subscripts on NetBSD®
- Adjust manual page to the fact that mksh can be used as /bin/sh although it's not specifically designed to
- Simplify mdoc/nroff macro load in manual page
- Add sample file: dot.mkshrc
- Correct and enhance book citation list in the manual page
- Bring back the "version" editing command in both emacs and vi modes, at ESC ^V like AT&T ksh93r+
- Fix typo which resulted in the wrong names for signals being printed (error codes were used instead) on GNU/Linux, Solaris and GNU/Cygwin. Ease changing signame/siglist sources.
- Some more code cleanup and redundancy removal
- Merge a few OpenBSD changes, yielding better multiline prompt support and textual improvements in the manual page
- Adjust $PS1 sizing, printing, and redrawal routines for mksh behaviour and single- and multiline prompts
- Unbreak build process on Cygwin, fix manpage generation
- For the AT&T $PS1 hack (second char = CR), do not output the delimiting characters any more, even if they are printable – fixes platforms without non-printable characters (Interix, Cygwin) and prompt size calculation
- Calculate length of prompt in lines and columns-of-last-line instead of using some tricks to skip the beginning of the prompt, resulting in correct redrawing of prompts with ANSI colour codes
- Correct displaying of prompts spanning more than one line and/or with embedded newlines or carriage returns; correct documentation of $PS1 and the redraw editing command
- Change one of the testsuite "expected failure" tests from bug to feature – it might actually be required by make(1)
- Enable to bind key sequences which consist of the usual optional one or two præfices and the control character, as well as an optional trailing tilde (if the trailing character is not a tilde, it's processed as usual, but processing of the editing command is postponed until after the trailing character has been read)
- Bind the NetBSD® wscons (vt220 / wsvt25), GNU screen and XFree86® (xterm-xfree86) "home", "end" and "delete" keys to ^A, ^E and ^D, respectively, except that "delete" does not act as logoff switch
- Correct Test.sh shebang line
- Make sure ^T is bound to 'transpose' as documented (bug spotted by hondza)
- Remove the 'stuff' and 'stuff-reset' editing commands
- Correct the manual page regarding the 'abort' command, its interaction with 'search-history' and how to exit the latter
- Bring back "set -o posix" turning off 'braceexpand'
- Mention IRC channel #mksh/Freenode in manual page
- Merge gensigs.sh into Build.sh, eliminating the need for $SHELL and making it more robust to broken user shells such as zsh, use the mksh just built for Test.sh; simplify CPPFLAGS and reduce size of generated table
- Run the signal name generator only if needed
- Use the -c option to GNU nroff, always
- Make the "all commands of a pipeline are executed in a subshell" issue a dependable mksh feature
- Improve regression test comments and a few tests
- If $RANDOM is generated from arc4random(3), display at most 31 bits of it like nbsh(1), instead of only 15 bits.
- Rename the regression test script from Test.sh to test.sh
- Improve Build.sh output regarding other files than the binary
- Mention #ksh/Freenode in the manual page, since its founder (twkm) said it's okay and on-topic as well
- Fix persistent history, add regression test
- Check for arc4random(3) and arc4random_push(3) by using the compiler instead of hardcoding OSes which have and which don't, because that's not always true
- Fix some regression tests (based upon user feedback too)
We recommended mksh R27e to be used:
- Allow Test.sh to be passed parameters (-v)
- Fix all -Wchar-subscripts on Solaris/sparc64 and NetBSD®/alpha and remove -Wno-char-subscripts from Build.sh
- Correct date in version and manual page
What became of mksh R27d in the meanwhile?
- Changes for easier crossbuildability
- Honour $CPPFLAGS in gensigs.sh
- Only source ${ENV:-~/.mkshrc} for interactive (FTALKING) shells
- There's a chance that non-MirOS systems have arc4random_push(3) at some time in the future, so make it configurable.
Featuring mksh R27c with these changes:
- emacs-usemeta now behaves like vi-show8 (be careful with 0x80-0x9F)
- Portability cleanup and speed-up; refine præprocessor defns
- GNU groff compatible manual page
- Fixes for Solaris 10 support
- Add ~/.mkshrc as $ENV feature (see manual page)
- Illustrate interactive shell tricks ($PS1) in manual page
- Enhance testsuite
- Incorporate some more code cleanup by OpenBSD
- Reference the O'Reilly books in the manual page
- R27c: fix packaging errors of previous versions
Changes in the minor version R26c, relative to R26b:
- Code cleanup by OpenBSD
- Documentation enhancements
- Fix gcc4 warnings in portable mksh
Changes in the minor version R26b, relative to R26:
- Makeup changes to copyright file (change comment leader)
- Sync licence with MirOS template (disclaimer changed a little)
- When building, generate a ./Test.sh on the fly which can be used instead of having to copy and paste a long line to run the regression test suite (still no way to run ifs.sh as we cannot distribute it, though).
- Add a few programming tricks to the manual page
- Fix abuse of unquoted characters in the manual page
- (no actual source code changes)
New major version R26 changed this, relative to R25b:
- Change the behaviour of \" in here documents to adhere SUSv3 (inspired by OpenBSD, most code by tg@)
New minor version R25b contains these changes:
- arc4random_push(3) does not exist on older MirOS systems; fixes build on MirOS #7quater
- Add GNU Cygwin to the list of supported platforms
New major version R25 contains these changes:
- Some manual page fixes and updates
- On window resizing, the COLUMNS and LINES variables are updated automatically, not only after the next command (from OpenBSD)
- Fix some redraw problem (from OpenBSD)
- Allow < and > for test and [, not only [[
- If an array index is out of bounds, tell which one (from OpenBSD)
- Add mknod(8) for pipes (user/root) and devices (root only) as a shell builtin – idea and some of the code from OpenBSD
- Improve compatibility with Solaris, GNU/Linux, Darwin, Interix
- Prevent redefinition of __rcsid string on systems without __RCSID macro (found by Han Boetes)
- Remove the need to manually specify -d on some OSes which need it
- Add a compiler flag to reduce some spurious Solaris-only warnings
R24c is another clean-up release, with no change to KSH_VERSION.
- Document stance on quoting policy in here documents
- More fixes for GCC 4 warnings
R24b is a minor clean-up release, recommended especially on Darwin.
- please GCC 4 with the usual crazy set of warning flags
- remove 'version' editor binding and remap emacs ^V to quote-meta ('literal')
- use open(2) instead of creat(3), from OpenBSD
- [bsiegert] fix order of includes
- some code simplification; no explicit LFS needed any more
R24 is an important bug fix release and the new required minimum version to be installed for MirMake. Changes are:
- GNU/Cygwin is now supported but not officially tested
- DragonFly BSD is now supported and officially tested
- FreeBSD should work as a side effect of the above
- On NetBSD, arc4random(3) can now be used if it exists
- no longer look at argv[0] to determine if restricted shell
- changes to $EDITOR and $VISUAL no longer affect the current editing mode
- emacs on, emacs-usemeta off is now the default editing mode
- the special "posix" and "sh" modes are gone
- code, test suites and documentation have been cleaned up a little
- Korn's bizarre /dev/fd hack is now no longer supported
- undo fix for Debian PR #71256 which turned to be bogus and break make(1)
- fix compilation and invocation of test suite with whitespace in the pathnames for real, this time
- the distfile is now signed using gzsig(1)
R23 comes with an overhauled build system providing more flags for easier configuration, a bug-fix if the relative path to $0 contained a space, and does not need h2ph(1) to build some headers any more. Also, the code has cleaned up a bit and some manual page glitches were corrected. Some of these changes originated by Han Boetes, a few came via the OpenBSD project.
R22d is the first version which works if source or build directory contain spaces in the pathname. It also allows building without bothering to pre-format the manual page.
R22c contains some compile time warning fixes on non-MirOS platforms.
R22b contains an important fix regarding the srand(3) initialisation logic and a portability fix for NetBSD.
R22 is the result of three different kinds of work: integrating diffs from Debian's pdksh package, as needed, including fixing bugs and of course testing and fixing docs; fixing the dreaded emacs-mode filename with brackets (hello AONE); much cleanup and polishing. Also, the new codebase has been tested on a fair number of systems now, with more to follow (maybe even new, currently unsupported, platforms).
R20b contains some minor arc4random and build fixes against R20.
R21 has been a three-way integration work from OpenBSD-current's ksh, MirOS-current's ksh and portable mksh R20. This is the first release to come without autoconf'd script; it is much smaller and installs both faster and easier. Several bugs have been fixed, the testsuite has been enhanced and the code was cleaned up largely. pdksh lookalikeness was largely dropped, and support for octal and sedecimal (hexadecadic) numbers via prefixing with 0 or 0x has been added. This is an experimental release; it is not yet supported e.g. by MirMake — make(1) — or other tools but this will follow soon. MirbsdKsh R21 is to be the only shell available on MirOS #9.
R20 integrated an experimental bugfix from millert@openbsd and shuffled some code around. OS/2 support vanished, and the rest of the code shrank and was optimised. This is the first version since v1.11 to work on SFU (Interix) 3.5 as-is. The upgrade to R20 is highly recommended. Note: the mksh R20 distfile has changed from before Dec 14, 16:00.
R19 changes back a bugfix from R18 which caused a regression (from OpenBSD) and changed behaviour to match ksh88 on Solaris (from OpenBSD).
v1.18 (R18) fixes some core dump bugs and is a recommended update.
v1.17 comes out with the final MirOS licence template applied, but not yet OSI approved (it's not our fault though). There are regression fixes and bug fixes; IFS field splitting now works as documented. This version is a major improvement both over v1.16 and OpenBSD /bin/ksh, so please use it and report possible bugs.
v1.16 IS A BETA VERSION, use at your own risk. This version comes with a code cleanup session (for compilation with -Wall -Werror -W -pedantic and in preparation for doing an indent(1) whack over the source; any volunteers?) and some new features (with -T it spawns on a different tty than you're on - cool for single user mode) and code removed (the mailbox checking functionality, since everyone sane uses UW-IMAPD to access his MBX format folder using IMAPS, port 993, even to localhost). The code is also ANSIfied and protoised, in preparation for style(9) aka KNF.
There were no v1.13, v1.14, and v1.15 was never released as portable version. MirbsdKsh version numbers were pretty much RCS IDs at the time of writing this paragraph.
v1.12 fixes the manpages and minor stuff, as well as a signalling bug and the inability to build without gcc installed as gcc. It also adds installation hints for various operating systems.
v1.11 is a minor update to v1.10 with a few build and style fixes only.
Recommendations on version numbering
mksh by default uses a version numbering scheme that uses full integers, prefixed by a capital letter R significing “Release”. If minor updates are required or requested, a lower-case letter from the standard latin alphabet will be appended, starting at ‘b’ and ending at ‘z’ (but usually way before or at ‘i’). If a packaging system cannot handle version numbers such as mksh-R29b (source) → mksh-R29b-1, mksh-R29bp1 (binary), packagers OUGHT TO map this to a numerical system as follows: mksh-29.2-1, mksh-29.2.1, mksh-29.2nb0, depending on the packaging-system local policy for build numbers / patchlevels.
Schemes to AVOID are mirbsdksh-1.29b, mksh-2.9.2, or worse. Please adhere to our recommendations so that users are able to locate mksh in their operation environment of choice.
/bin/ed
While we’re at it — recommendations for packagers — there is another set of do’s and dont’s: location of the UNIX® standard text editor. As outlined in traditional unixoid operating system standards, manifested into POSIX, and — for these three-letter words that aren’t Unix, no matter which of the kernels they use in their variety of so-called distributions — the FHS (FSSTND): ed lives in /bin/ed, period.
Patching mksh’s code to look for ed in ANY other location is a MUST NOT.
Future Plans
- newer plans
- make -g arbitrarily limit recursion depth so fuzzers don’t run into stack underflows when triggering unlimited recursion
- bash-style multiline command line editing, as an option (the current horizontally scrolled one is finally (with R28) bug-free even with multiline and very long prompts optionally with embedded newlines, and more suitable for small terminals) ‣ not portable w/o curses
- Ensure arithmetics are properly bound to mksh_ari_t and mksh_uari_t and offer switching to 64 bit, including as array index type, as a compile time option; seeing as some systems (DEC?) may not have a 64 bit type ‣ partially done with lksh
- Adding goto and label keywords/commands
- Can not [[ or (( yield the inode of a file, if we don’t get a stat(1) builtin? (For hashes by file.) Maybe make a builtin that expands struct stat into an associative array?
- Adding builtins fstat, lstat, traverse, …
- for a b in …; do (like make(1) does)
- ${foo:S/bar/baz/g} and maybe ${foo:C/bar/baz/x} via regex(3)
- A sensible website
- Real Unicode command line editing code
- Real Unicode internal op — ${foo:2:3} now works with MirOS OPTU-8 but having internal representation being MirOS OPTU-16 would help in the long term
- /etc/mkshrc (maybe only if ~/.mkshrc does not exist, with similar rules; ENV=/ could be the magic "default" value; maybe go through $ENV -> ~/.mkshrc -> /etc/mkshrc by both existence and being >0 bytes... ‣ probably rejected