Developers’ Weblog

Sponsored by
HostEurope Logo

Developers’ Weblog

All 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40

mksh R59 released

2020-04-15
Tags: mksh news pcli

With a mixed bag of changes, I’ve released mksh(1) R59 yesterday. Some of those changes are breaking to the shell language:

  • When printf(1) was compiled as builtin, and a matching external utility (i.e. $(which printf)) didn’t exist, and builtin printf was not used to specifically invoke the built-in utility, it could not be found. This is critical but only for a very small area: mostly when mksh (or more specifically lksh), with printf as builtin, is used as /bin/sh and the udev SYSVinit script uses printf while insisting on setting PATH to just /bin while printf(1) sits in /usr/bin. If this affects you, you want this fix.
  • OS/2 only: the test(1) builtin already sometimes automatically added the suffixes .ksh, .exe, .sh, .cmd, .com, .bat to a file argument if one without these sufficēs was not found. This was extended to cover more cases to improve the user experience. (Thanks to KO Myung-Hun for this!)
  • The output from some builtins is now formatted differently. This mostly affects how alias names, and in some cases their definitions, are printed (by alias, command, whence, etc.) and the output from the bind builtin was also made safe for re-entry into the shell. These are desirable from a security PoV but change formats.
  • In the manpage, some documentation was wrong: the example command given for how tab completion escapes, and the right-hand side of string comparisons only globs in [[, not in [ and test.
  • The shell argv[0] (after removing a leading dash to indicate a login shell and using the basename(1) of the rest) is now checked whether it begins with an ‘r’, and if yes, restricted mode is enabled.
  • In [[ x = $y ]] we now parse the right operand $y as full extglob.
  • Since we already have breaking changes, the former global builtin introduced in R40b and deprecated, in favour of typeset -g in R55, was removed.
  • ^[Q (Esc+Q) was added as new editing command, quoting (for use as shell parameter, i.e. with '…' or $'…' like typeset does) the area between the mark and the cursor.
  • The manual page, besides featuring properly spaced “em” dashes, was completely overhauled in documenting reserved words and built-in utilities and now also documents built-in aliases and even those aliases and functions dot.mkshrc offers, more or less verbosely, and indicating, with every entry, which is which, including specialness and keeping assignments, deferring (with flags, like cat, or always, i.e. rename and the optional printf), being a declaration utility (where ‘b’ in export a=b is not IFS-splitted) or declaration utility forwarder (like command export a=b also skips the field splitting) and requirements (such as job control, or the presence of select(2) etc.)
  • The testsuite works again with OS/2 and pre-glibc_2.30-5 GNU/Hurd.

Now some of these changes are desirable and indicate you ought to upgrade. If you can’t (due to the breaking changes), talk with me, and I may release an R58b with only some of the changes. But please do consider whether R59 might work just as well. TIA!

MirBSD Logo