MirBSD Korn Shell R50f

The MirBSD Korn Shell (mksh) is an actively developed successor of pdksh (the Public Domain Korn Shell), aimed at producing a shell good for interactive use, but with the primary focus on scripting. It is intended to be portable to most *nix-like operating systems as long as they're not too obscure. mksh incorporates improvements from OpenBSD and Debian, as well as bugfixes and enhancements developed for the MirOS, FreeWRT, and MidnightBSD projects and Android. The emacs command line editing mode is UTF-8 capable, and Byte Order Marks are ignored in scripts. The shell supports large files, as well as all pdksh and some csh, AT&T ksh, zsh, and GNU bash features, is compatible with the Bourne shell and POSIX (within limits), has no limit on array sizes, and incorporates some other useful builtins and features. While being already fast and small (without losing functionality), flags to make it even smaller can be given at compile time. An interactive shell reads "~/.mkshrc" on startup.

Tags shell korn-shell ksh
License MirOS
State stable

Recent Releases

R50f19 Apr 2015 22:50 security: Add a patch marker for vendor patch versioning to mksh.1. SECURITY: make unset HISTFILE actually work. Document some more issues with the current history code. Remove some unused code. RCSID-only sync with OpenBSD, for bogus and irrelevant changes. Also disable field splitting for alias 'local= typeset'. Fix read -n-1 to not be identical to read -N-1. Several fixes and improvements to lksh(1) and mksh(1) manpages. More code (int size_t), comment and testsuite fixes. Make dot.mkshrc more robust (LP#1441853). Fix issues with IFS=' ' read, found by edualbus. Fix integer overflows related to file descriptor parsing, found by Pawel Wylecial (LP#1440685); reduce memory usage for I/O redirs. Document in the manpage how to set U according to the current locale settings via LANG/LC_* parameters (cf. Debian #782225). Some code cleanup and restructuring. Handle number parsing and storing more carefully.
R50e28 Mar 2015 18:00 minor bugfix: Add more tests detailing behaviour difference from GNU bash. Introduce a memory leak for x= fixing use of freed memory instead. Add x+= parallel to x= . POSIX command loses builtin special-ness. Update location of FreeBSD testsuite for test(1). Remove dead NULL elements from Emacs keybindings. Change several testcases for */ @ expansion with/without quotes to expected-fail, with even more to come . Fix miscalculating required memory for encoding the double-quoted parts of a here document or here string delimiter, leading to a buffer overflow. Rename a function conflicting with a MacRelix system header. Use size_t (and ssize_t) consistently, stop using ptrdiff_t; fixes some arithmetics and S/390 bugs. Remove old workarounds for Clang 3.2 scan-build. Remove all Clang/Coverity assertions, making room for new checks. Fix NSIG generation on Debian sid gcc-snapshot. Make a testcase not fail in a corner case. Fix issues detected by GCC s new sanitisers: data type of a value to be shifted constantly must be unsigned (what not, in C ); shebang check array accesses are always unsigned char. Be even more explicit wrt. POSIX in the manpage. Fix shebang / file magic decoding. More int bool conversion. Let Build.sh be run by GNU bash 1.12.1 (Slackware 1.01). Fix here string parsing issue. Point out more future changes in the manpage. Call setgid(2), setegid(2), setuid(2) before seteuid(2). Fix spurious empty line after ENOENT whence -v . Optimise dot.mkshrc and modernise it a bit. Use MAXPATHLEN from for PATH_MAX fallback. Some code cleanup and warnings fixes. Add options -a argv0 and -c to exec. Prevent use-after-free when hitting multiple errors unwinding. Fix use of * and @ in scalar context: within and after case and in here documents; fix here document expansion. Unbreak when @ shares double quotes with others. Fix set -x in PS4 expansion infinite loop.
R50d23 Oct 2014 21:02 major bugfix: Fix NULL pointer dereference on unset x; nameref x . Fix severe regression in field splitting. Add a warning about not using tainted user input (including from the environ(7)ment) in arithmetics.
R50c03 Oct 2014 19:55 security: Know more rare signals when generating sys_signame replacement. OpenBSD sync (mostly RCSID only). Document HISTSIZE limit; found by luigi_345 on IRC. Fix link to Debian .mkshrc. Cease exporting RANDOM (Debian #760857). Fix C99 compatibility. Work around klibc bug causing a coredump (Debian #763842). Use issetugid(2) as additional check if we are FPRIVILEGED. SECURITY: do not permit += from environment. Fix more field splitting bugs reported by Stephane Chazelas and mikeserv; document current status wrt. ambiguous ones as testcases too.
R50b10 Sep 2014 23:00 minor bugfix: Fix operator description in the manpage. Change all mention of eglibc to glibc , it is merged back. Fix rare infinite loop with invalid UTF-8 in the edit buffer. Make more clear when a shell is interactive in the manpage. Document that is a symmetric remainder operation, and how to get a mathematical modulus from it, in the manpage. Make the cat(1) builtin also interruptible in the write loop, not just in the read loop, and avoid it getting SIGPIPE in the smores function in dot.mkshrc by terminating cat upon user quit. Make some comments match the code, after jaredy from obsd changed IFS split handling. Fix some IFS-related mistakes in the manual page. Document another issue as known-to-fail test IFS-subst-3. Improve check.pl output in some cases. Relax overzealous nameref RHS checks.
R5003 Jul 2014 19:14 minor feature: Fix initial IFS whitespace not being ignored when expanding, MKSH_BINSHREDUCED no longer mistakenly enables brace expansion, explain more clearly Vi input mode limitations in the manpage, improve error reporting of the check.pl script, use TMPDIR in test.sh for scratch space, check that the scratch space is not mounted noexec, use termcap(5) names, not terminfo(5) names, in tput(1) examples, for improved portability (e.g. to MidnightBSD), avoid C99 Undefined Behaviour in mirtoconf LFS test, fix !foo for when foo is unset, improve nameref error checking, fix readonly bypass, improved system reporting for Mac OS X, explain better extglob handling in the manpage, remove arr=( index =value) syntax due to regressions, IFS-split arithmetic expansions as per POSIX 201x, add more detailed Authors section to manpage, fix set p issue for good: drop privs unless requested, improve signal handling and use a more canonical probing order, fix return values ? and PIPESTATUS * interaction with set -o pipefail and COMSUBs, detect ENOEXEC ELF files and use a less confusing error message, update to Unicode 7.0.0, shut up valgrind in the RANDOM code, use -fstack-protector-strong in favour of -fstack-protector-all, fix access-after-free crash