Skip to content

Commit

Permalink
v0.16.2: first stable 0.16.x release
Browse files Browse the repository at this point in the history
This stable release ends the testing stage on the 0.16 branch. From
now on, new 0.16.x versions will only be released to fix serious
bugs, if found. Development towards 0.18.0 is continuing on the Git
master branch.

Below is a summary of the most important changes between
v0.16.1-alpha and v0.16.2. For full details, see the git log
(which has very descriptive commit messages).

CHANGED:

  * 'str ematch' now properly supports full POSIX Extended Regular
    Expressions (EREs) on all shells and operating systems,
    including bounds/interval expressions and POSIX character
    classes. On shells without this feature built in, 'str ematch'
    now uses an awk script that converts a POSIX ERE to a
    traditional awk RE before matching it. Related changes:
    - The WRN_EREBOUNDS warning ID is removed.
    - A new WRN_EREMBYTE warning ID is added. If 'thisshellhas
      WRN_EREMBYTE', you're in a multibyte (UTF-8) locale but the
      system's awk does not support UTF-8 characters, so 'str
      ematch' cannot match these properly in EREs.

  * New 'chdir' command, a robust 'cd' replacement for script use.
    A replacement for 'cd' in scripts is needed because 'cd' has
    features designed for interactive shells that make robust and
    portable use in scripts far too difficult: (1) a user's
    exported $CDPATH could easily cause the wrong directory to be
    entered; (2) certain names are interpreted as special operands
    even after '--', so using arbitrary/untrusted directory names
    is not safe, and (3) the PWD it sets is not safe against
    symlink attacks by default.
       It is possible to work around these problems, but this is
    only really doable with a library function like chdir. The use
    of 'cd' in modernish scripts is now deprecated.

  * Modernish commands that handle long-form shell options (such as
    'push -o OPTION', 'pop -o OPTION') now deal correctly with
    abbreviated shell option names on shells where these can
    natively be abbreviated: ksh93 and yash. This capability is now
    detected under the ID QRK_OPTABBR.

  * mktemp (sys/base/mktemp):
    - the -t option now uses the XDG_RUNTIME_DIR environment
      variable if set. It also no longer dies if that or TMPDIR has
      a bad value; it just won't use it.
    - the -C autocleanup option can now be used in a subshell
      alongside -s and using the tmp file name left in $REPLY
      (not that autocleanup happens on exiting the subshell).

  * readlink (sys/base/readlink):
    - Added the canonicalisation options '-e' (all pathname
      components must exist) and '-m' (none need exist) as in
      GNU 'readlink'.
    - Now supports //UNC/network/paths on Cygwin.

  * which (sys/base/which) now converts relative paths it finds
    to absolute paths, a behaviour that matches GNU 'which'.

  * var/loop: Iteration generator processes can now read from
    standard input as normal (except on interactive shells).
    And stdout is now redirected to stderr instead of closed.

  * LOOP find (var/loop/find):
    - Now supports portable use of the GNU-style '-mindepth n' and
      '-maxdepth n' options, as well as the BSD-style '-depth n',
      '-depth -n', '-depth +n' expression primary. These are
      internally translated to a portable expression.
    - Since loop iteration generators can now read from standard
      input, LOOP find now accepts the -ok and -okdir primaries.

  * In modernish safe pathname expansion (var/local, var/loop),
    resulting paths starting with '+' are now also automatically
    escaped by prefixing './', because some commands have options
    or special operands that start with '+'.

  * New example program: Modernish Dice.
    See: share/doc/modernish/dice.sh

  * Unfortunately, the latest Korn shell 2020.0.0 release is too
    buggy to run modernish. One of its many bugs is that EXIT traps
    don't work in subshells: att/ast#1452
    There is no possible workaround, so this is a fatal bug.
    Modernish now refuses to initialise upon detecting this bug.
    The only ksh93 release known to work is AJM 93u+ 2012-08-01.

  * Changes in shell capability IDs for thisshellhas:
    - OPTNOPREFIX is renamed to QRK_OPTNOPRFX.
    - New shell bugs/quirks detected and identified:
      BUG_CMDSETPP (mksh <= R57)
      BUG_ASGNLOCAL (zsh <= 5.7.1)
      BUG_CASEPAREN (bash 3.2)
    - New shell quirks detected and identified:
      QRK_ANDORBG (zsh)
      QRK_OPTABBR (ksh93, yash)

  * On interactive shells, if a command in a multi-process job
    calls die(), the entire job is now reliably interrupted.

FIXED:

  * On shells with BUG_PUTIOERR, the var/loop module now refuses to
    initialise if SIGPIPE is ignored. This avoids loop iteration
    generators being stuck writing infinitely into the void.

  * thisshellhas: the --cache or --show options could end up in
    an infinite loop upon encountering a cap/*.t file with an
    invalid ID name.

  * shellquote: assignment-arguments didn't work for values
    exempt from quoting like: shellquote var=[.

  * sys/base/seq: the -f option did not correctly handle arbitrary
    format strings.

  * put/putln died on I/O error on FreeBSD sh.

  * str:
    - For an empty variable $empty (which is removed when unquoted,
      even in the safe mode), str returned the wrong result for:
            str {eq,ne,in,begin,end,match} $empty ""
            str isvarname $empty
    - str match: handling of a dangling final backslash was broken.
    - str ematch: on shells where this depends on awk, arguments
      starting with a dash failed because they were misinterpreted
      as awk options.

  * mapr (var/mapr):
    - Empty input caused an infinite loop.
    - "Arguments list too long" errors still occasionally occurred
      on some systems when using mapr with external commands. Fixed
      by using a much more conservative arguments length limit.

  * LOOP select (var/loop/select) didn't cope with REPLY being
    unset within the loop.

  * trace (sys/cmd/harden): Traced commands died on status 128.

  * use: Modules could be erroneously loaded/initialised more than
    once if a slightly different variant of the name was given: a
    leading or trailing slash, or a double slash. Fixed by
    detecting these variants as invalid.

  * % (sys/cmd/procsubst):
    - Would hang on AT&T ksh93. Fixed by forcing the non-forked
      command substitution subshell to fork.
    - Work around an AT&T ksh93 bug with the 'command' command,
      so that e.g. 'cat < $(% command ls)' now works on ksh93.
    - With '% -o', standard output was closed for the launched
      command. Fixed by redirecting it to standard error.
    - Die on no command given and on empty command.

  * LOOP repeat (var/loop/repeat): died with a spurious "invalid
    arithmetic expression" error message on 0 interations.

  * readlink (sys/base/readlink):
    - The --help option wasn't parsed correctly.
    - When canonicalising a path ending in '/', readlink would
      erroneously print the final '/'.
    - Encountering a recursive symlink would cause an infinite
      loop. Fixed by keeping track of symlinks already seen.

  * which (sys/base/which): Given an existing '/command' in the
    root directory, 'PATH=/:$PATH; which command' yielded
    '//command', and 'which /command' did not work at all.

  * var/stack/trap:
    - The logic for resending a signal (in case traps were pushed
      but no POSIX trap is set) was broken, so that e.g. TSTP
      failed to stop the shell, among other bugs.
    - On some shells, CHLD stack traps would trigger themselves,
      causing infinite signal loops.
    - DIE/INT traps on interactive shells were broken when they
      themselves called die(), causing ugly misbehaviour.
    - On zsh, 'trap' did not print ZERR/ERR traps correctly.
    - poptrap: A stack corruption fatal error occurred when
      attempting to pop a trap in a subshell.

OPTIMISED:

  * var/loop/select: Stop iteration generator while waiting for
    reply. This makes 'LOOP select' much better behaved: we avoid
    filling up the interprocess buffer while still remaining
    responsive if a user gives many replies in quick succession.
  • Loading branch information
McDutchie committed Jan 11, 2020
1 parent b96e6bd commit 05c51f7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,4 +1,4 @@
Copyright (c) 2019 Martijn Dekker <martijn@inlv.org>, Groningen, Netherlands
Copyright (c) 2020 Martijn Dekker <martijn@inlv.org>, Groningen, Netherlands

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
Expand Down
4 changes: 2 additions & 2 deletions bin/modernish
Expand Up @@ -12,7 +12,7 @@
# POSIX reference: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/contents.html
#
# --- begin license ---
# Copyright (c) 2019 Martijn Dekker <martijn@inlv.org>, Groningen, Netherlands
# Copyright (c) 2020 Martijn Dekker <martijn@inlv.org>, Groningen, Netherlands
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
Expand Down Expand Up @@ -134,7 +134,7 @@ _Msh_initExit() {
}

# The version and location of modernish.
MSH_VERSION=0.16.1-alpha
MSH_VERSION=0.16.2
MSH_PREFIX=${srcdir:-$(_Msh_D=.; case $0 in (*/bin/modernish) _Msh_D=${0%/bin/*};; esac; CDPATH='' cd -- "$_Msh_D" && pwd -P)} || _Msh_initExit # this line will be changed by install.sh
MSH_MDL=$MSH_PREFIX/lib/modernish/mdl
MSH_AUX=$MSH_PREFIX/lib/modernish/aux
Expand Down

0 comments on commit 05c51f7

Please sign in to comment.