dtksh: Upgrade ksh93 to 1.0.0-beta.2 2021-12-28

Patch from current ksh93 maintainer <https://github.com/ksh93/ksh>.

cde/programs/dtksh/ksh93/**:
- Upgraded. A load of bugs fixed, some minor features added.
  See NEWS from 2021-02-01 upwards.

cde/programs/dtksh/Makefile.am:
- Don't cd into ksh93 any more to invoke the package or shtests
  scripts; they now automatically find their directories.
- Pass $(CFLAGS) to build ksh with optimisation.
- Remove -D_std_malloc flag as vmalloc is now deprecated and disabled
  by default.
- Add a 'make check' target to Makefile.am that runs the ksh93
  regression tests on dtksh to make sure the additions don't interfere
  with anything. It skips running the tests with shcomp because CDE
  doesn't use that. The tests all pass here on Slackware 14.2. :-)

cde/programs/dtksh/init.patch:
- Removed; I've upstreamed it. It was the only one that wasn't upstreamed
  yet, and more code cleanups are coming, breaking downstream patches. If
  something needs updating, just email me a diff.

cde/programs/dtksh/dtkcmds.h:
- Update the ADDBUILTIN macro to remove the __PROTO__ macro use. The
  proto(1) tool, responsible for all such pre-C89 K&R C compatibility
  voodoo, has been removed, so that macro is no longer defined.

cde/programs/dtksh/setup.sh:
- Workaround script removed. I rewrote 'bin/package flat make' in a way
  that works correctly and changed Makefile.am to use that instead.

Hope this helps. Happy new year.
This commit is contained in:
Martijn Dekker
2022-01-02 14:34:46 +01:00
committed by Jon Trulson
parent d5e651ecf3
commit bf00d3b274
1179 changed files with 22005 additions and 45914 deletions

View File

@@ -3,6 +3,778 @@ For full details, see the git log at: https://github.com/ksh93/ksh
Any uppercase BUG_* names are modernish shell bug IDs.
2021-12-28:
- Fixed a bug that caused CDPATH to continue working after unsetting it.
- Added three options to the ulimit builtin with the same names and
functionality as in Bash:
- 'ulimit -k' sets the maximum number of kqueues.
- 'ulimit -P' sets the maximum number of pseudo-terminals.
- 'ulimit -R' sets the maximum time in microseconds a real-time process
can run before blocking.
Note that to use these options the operating system must support the
corresponding resource limit.
- Ported performance optimizations from illumos to improve the performance
of the cksum builtin. (Note that the cksum builtin is not enabled by
default.)
2021-12-27:
- Two bash-like flags for 'whence' were backported from ksh 93v-:
- 'whence -P/type -P' is an alias to the existing -p flag.
- 'whence -t/type -t' will print only the type of a command in a simple
format that is designed to be easy to use for scripts. Example:
$ type -t typeset; whence -t sh
builtin
file
- Fixed a crash or freeze that would occur on Linux when using Ctrl+C to
interrupt a command substitution containing a pipe in an interactive shell.
- Fixed a crash that could occur while processing a here-document while
xtrace (set -x) is on and the $PS4 prompt contains parameter expansions or
command substitutions.
- The mkservice and eloop builtins can now be built by enabling the
new SHOPT_MKSERVICE setting in src/cmd/ksh93/SHOPT.sh.
2021-12-26:
- Listing aliases or tracked aliases in a script no longer corrupts
shcomp's generated bytecode.
- Listing specific aliases with 'alias -p' and specific tracked aliases
with 'alias -pt' now works as documented. This means that the following
string of commands now works as you would expect:
$ hash -r; unalias -a
$ alias foo=bar; hash cat
$ alias -p foo; alias -pt cat
alias foo=bar
alias -t cat
- As a result of the above fix, listing all tracked aliases with 'alias -pt'
now prints commands that can be reused to recreate the tracked aliases.
- Attempting to list a non-existent alias or tracked alias with the -p option
now causes an error and sets the exit status to the number of non-existent
aliases passed.
- Attempting to list 256 non-existent aliases now errors out with the exit
status set to one.
2021-12-22:
- Process substitutions run in a profile script no longer print their
process ID when run.
2021-12-21:
- Fixed a bug that caused subshells (such as code blocks in parentheses) to
partially behave like the interactive main shell after running anything
that invokes the parser. For example:
$ (eval :; sleep 1 & echo done)
[1] 30909 <--- incorrect job control output from subshell
done
- Fixed: after suspending (Ctrl+Z) a subshell that is running an external
command, resuming the subshell with 'fg' failed and the job was lost.
$ (vi) <--- press Ctrl+Z
[2] + Stopped (vi)
$ fg
(vi) <--- vi failed to resume; immediate return to command line
$ fg
ksh: no such job
2021-12-17:
- Release 1.0.0-beta.2.
- Ksh no longer behaves badly when parsing a type definition command
('typeset -T' or 'enum') without executing it or when executing it in
a subshell. Types can now safely be defined in subshells and defined
conditionally as in 'if condition; then enum ...; fi'.
- Single digits can now be compared lexically in [[ ... ]] with the
< and > operators.
2021-12-16:
- Changed the default selection of compiled-in /opt/ast/bin built-in libcmd
command to: basename, cat, cp, cut, dirname, getconf, ln, mktemp, mv.
Add /opt/ast/bin to your $PATH to use these. Type 'cp --man', etc. for info.
- A bug introduced on 2020-09-17 was fixed that caused interactive ksh to exit
if Ctrl+C was pressed while SIGINT was being ignored (as in "trap '' INT").
2021-12-13:
- Fixed a bug introduced on 2020-08-09 that prevented '.' and '..' from
being completed when using file name tab completion.
- Fixed a bug on illumos that caused the chown builtin to fail with 'Invalid
argument' after failing to change the ownership of a file twice using an ID
that doesn't exist in /etc/passwd. (Note that the chown builtin is not
enabled by default.)
2021-12-11:
- Fixed two more crashing bugs that occurred if ksh received a signal (such
as SIGINT due to Ctrl+C) while the user is entering a multi-line command
substitution in an interactive shell.
- The shell linter's warning for variable expansion in ((...)) now tells the
user which variable is causing performance degradation.
- The shell linter now warns the user x=$((expr)) is slower than ((x=expr))
when assigning a value to a variable.
2021-12-09:
- Increased the general robustness of discipline function handling, fixing
crashing bugs with PS2.get() and .sh.tilde.get() disciplines, among others.
- Fixed a crash that occurred on the interactive shell if the PS1 prompt
contains multiple command substitutions and the user interrupts input
while the shell is on a PS2 prompt waiting for the user to complete a
command substitution of the form $( ... ).
2021-12-08:
- Fixed: if a function returned with a status > 256 using the 'return' command
and the return value corresponded to a value that could have resulted from a
signal, and an EXIT trap was active, then the shell mistakenly issued that
signal to itself. Depending on the signal, this could cause the shell to
terminate ungracefully, e.g. 'return 267' caused SIGSEGV ("memory fault").
- For the 'return' built-in command, you can now freely specify any
return value that fits in a signed integer, typically a 32-bit value.
Note that $? is truncated to 8 bits when the current (sub)shell exits.
- The head and tail builtins now correctly handle files that do not have an
ending newline. (Note that the tail builtin is not compiled in by default.)
2021-12-05:
- Fixed an issue on illumos that caused some parameters in the getconf
builtin to fail.
- The cd built-in command now supports a -e option (as specified in
https://www.austingroupbugs.net/view.php?id=253). Passing -e alongside -P
is used to guarantee the cd built-in returns with exit status 1 if the
current working directory couldn't be determined after successfully changing
the directory.
2021-12-01:
- Fixed a memory fault that occurred when a discipline function exited
with an error from a special builtin or when a discipline function exited
because of a signal.
2021-11-29:
- Fixed a memory fault that prevented ksh from functioning on ARM-based Macs.
- A bug that caused the time keyword to override the errexit shell option has
been fixed.
- Fixed a crash that could occur when a KEYBD trap was set and a multi-line
command substitution was input in an interactive shell.
- The shell linter's warnings for obsolete arithmetic operators in [[ ... ]]
and unnecessary variable expansion in ((...)) have been improved.
2021-11-24:
- The --posix mode was amended to stop the '.' command (but not 'source') from
looking up functions defined with the 'function' keyword. In the POSIX
standard and on other shells, the '.' command finds only script files.
- The rm built-in's -d/--directory option has been fixed. It now properly
removes empty directories and refuses to remove non-empty directories
(as specified in https://www.austingroupbugs.net/view.php?id=802). Note
that the rm built-in command isn't compiled in by default.
2021-11-23:
- A bug was fixed that allowed arithmetic expressions to assign out-of-range
values to variables of an enumeration type defined with the 'enum' command,
causing undefined behavior. Within arithmetic expressions, enumeration
values translate to index numbers from 0 to the number of elements minus 1.
That range is now checked for. Decimal fractions are ignored.
2021-11-21:
- It is now possible to use types defined by 'enum' in contexts where the
script is entirely parsed before (or without) being executed, such as
dotted/sourced scripts and scripts compiled by shcomp.
- Added support for the size mode to the stty(1) built-in. This mode is used
to display the terminal's number of rows and columns. Note that the stty
built-in is not compiled in by default. This can be changed by adding
stty to the table of built-ins in src/cmd/ksh93/data/builtins.c.
2021-11-20:
- Listing types with 'typeset -T' no longer displays incomplete versions of
types created by the enum built-in.
2021-11-18:
- The printf built-in command now supports a -v option as on bash and zsh.
This allows you to assign formatted output directly to a variable.
- Fixed a performance regression introduced on 2021-05-03 that caused
the shbench[*] fibonacci benchmark to run slower.
[*]: https://github.com/ksh-community/shbench
2021-11-16:
- By default, arithmetic expressions in ksh no longer interpret a number
with a leading zero as octal in any context. Use 8#octalnumber instead.
Before, ksh would arbitrarily recognize the leading octal zero in some
contexts but not others, e.g., both of:
$ x=010; echo "$((x)), $(($x))"
$ set -o letoctal; x=010; let y=$x z=010; echo "$y, $z"
would output '10, 8'. These now output '10, 10' and '8, 8', respectively.
Arithmetic expressions now also behave identically within and outside
((...)) and $((...)). Setting the --posix compliance option turns on the
recognition of the leading octal zero for all arithmetic contexts.
2021-11-15:
- In arithmetic evaluation, the --posix compliance option now disables the
special floating point constants Inf and NaN so that $((inf)) and $((nan))
refer to the variables by those names as the standard requires. (BUG_ARITHNAN)
- Fixed two file descriptor leaks in the hist builtin that occurred when
the -s flag ran a command or encountered an error.
2021-11-14:
- Fixed: ksh crashed after unsetting .sh.match and then matching a pattern.
- Another test/[ fix: "test \( string1 -a string2 \)" and "test \( string1 -o
string2 \)" no longer give an incorrect "argument expected" error message.
2021-11-13:
- The test/[ built-in command now supports the '<' and '=~' operators from [[.
As of now, test/[ supports the same operators as [[ except for the different
and/or operators. Note: test/[ remains deprecated due to its many pitfalls.
- The test/[ built-in command is fixed so that the binary -a (and) and -o (or)
operators, as in [ "$a" -a "$b" ] or [ "$a" -o "$b" ], work even if "$a" is
'!' or '('. To avoid breaking backwards compatibility with the nonstandard
unary [ -a "$file" ] and [ -o "$option" ] operators in combination with '!'
or parentheses, this fix is only activated if the posix option is on.
2021-11-07:
- Fixed a bug that could corrupt output if standard output is closed upon
initializing the shell.
- Improved BUG_PUTIOERR fix (2020-05-14) with more error checking. On
systems with the "disk full" error testing device /dev/full, an
echo/print/printf to /dev/full now always yields a non-zero exit status.
2021-09-13:
- Disable the POSIX arithmetic context while running a command substitution
invoked from within an arithmetic expression. This fixes a bug that caused
integer arguments with a leading zero to be incorrectly interpreted as octal
numbers in non-POSIX arithmetic contexts within such command substitutions.
2021-09-12:
- When invoking a script without an interpreter/hashbang path on Linux and
macOS, ksh can now update 'ps' output to show longer command lines.
2021-08-13:
- An issue was fixed that could cause old-style `backtick` command
substitutions to hang in certain cases.
2021-06-03:
- Fixed a bug in the [[ compound command: the '!' logical negation operator
now correctly negates another '!', e.g., [[ ! ! 1 -eq 1 ]] now returns
0/true. Note that this has always been the case for 'test'/'['.
2021-05-18:
- Fixed SHLVL so that replacing ksh by itself (exec ksh) will not increase it.
- Fixed a regression introduced on 2020-08-05 that caused a non-interactive
shell to exit if an I/O redirection of a function call encountered an error.
2021-05-13:
- Fixed a bug with 'test -t 1' that was introduced on 2021-04-26:
v=$(test -t 1 >/dev/tty && echo ok) did not assign 'ok' to v.
2021-05-10:
- Release 1.0.0-beta.1.
2021-05-07:
- Backported three ksh 93v- math.tab changes, allowing for an exp10()
arithmetic function if one exists in the C library, a new float()
function, and lastly an updated int() function that rounds to zero
instead of being an alias to floor().
2021-05-05:
- Fixed: a preceding variable assignment like foo=bar in 'foo=bar command'
(with no command arguments after 'command') incorrectly survived the
'command' regular built-in command invocation.
- Fixed: 'command -p some_utility' intermittently failed to find the utility
under certain conditions due to a memory corruption issue.
2021-05-03:
- Subshells (even if non-forked) now keep a properly separated state of the
pseudorandom generator used for $RANDOM, so that using $RANDOM in a
non-forked subshell no longer influences a reproducible $RANDOM sequence in
the parent environment. In addition, upon invoking a subshell, $RANDOM is now
reseeded (as mksh and bash do).
- Fixed program flow corruption that occurred in scripts on executing a
background job in a nested subshell, as in ( ( simple_command & ) ).
- Completed the 2021-04-30 fix for ${var<OP>'{}'} where <OP> is '-', '+',
':-' or ':+' by fixing a bug that caused an extra '}' to be output.
- Following the resolution of Austin Group bug 1393[*] that is set to be
included in the next version of the POSIX standard, the 'command' prefix
in POSIX mode (set -o posix) no longer disables the declaration properties
of declaration built-ins. This reverts a change introduced on 2020-09-11.
[*] https://austingroupbugs.net/view.php?id=1393
- Fixed arithmetic assignment operations for multidimensional indexed arrays.
2021-04-30:
- The emacs 'ESC .' (M-.) and vi '_' commands now take shell quoting into
account when repeating a word from the previous command line. For example, if
the previous command is 'ls Stairway\ To\ Heaven.mp3', then they now insert
'Stairway\ To\ Heaven.mp3' instead of 'Heaven.mp3'. Thanks to Govind Kamat.
- Fixed a bug introduced on 2020-09-05 that caused "echo ${var:+'{}'}"
to be misparsed.
- Fixed: the effects of 'builtin', 'exec' and 'ulimit' leaked out of a parent
virtual subshell if run from a ${ shared-state; } command substitution.
2021-04-26:
- Fixed a bug introduced on 2021-02-20 in which a shared-state command
substitution stopped sharing its state with the calling shell environment
if it executed a command that locally redirected standard output.
2021-04-22:
- shcomp (the shell bytecode compiler) was fixed to correctly compile process
substitutions used as the file name to a redirection, as in 'cmd < <(cmd)'.
- Fixed a bug introduced on 2020-07-13 that set LINENO to the wrong line
number after leaving a virtual subshell in which LINENO had been unset.
2021-04-21:
- Fixed a bug introduced on 2020-09-28 that caused an interactive ksh to exit
if a profile script (such as ~/.kshrc) contains a syntax error.
2021-04-20:
- Fixed three problems with the /opt/ast/bin/getconf built-in command:
1. The -l/--lowercase option did not change all variable names to lower case.
2. The -q/--quote option now quotes all string values. Previously, it only
quoted string values that had a space or other non-shellsafe character.
3. The -c/--call, -n/--name and -s/--standard options matched all variable
names provided by 'getconf -a', even if none were actual matches.
- The readonly attribute of ksh variables is no longer imported from
or exported to other ksh shell instances through the environment.
2021-04-16:
- Fixed a bug in emacs mode: after using tab completion to complete the name
of a directory, it was not possible to type numbers after the slash.
- Fixed an optimization bug that caused the <>; redirection operator to fail
when used with the last command in a -c script.
2021-04-14:
- Path-bound built-ins (such as /opt/ast/bin/cat) can now be executed by
invoking the canonical path, so the following will now work as expected:
$ /opt/ast/bin/cat --version
version cat (AT&T Research) 2012-05-31
$ (PATH=/opt/ast/bin:$PATH; "$(whence -p cat)" --version)
version cat (AT&T Research) 2012-05-31
Non-canonical paths such as /opt/ast/./bin/cat will not find the built-ins.
- Path-bound built-ins will now also be found on a PATH set locally using an
assignment preceding the command, so the following will now work as expected:
$ PATH=/opt/ast/bin cat --version
version cat (AT&T Research) 2012-05-31
2021-04-13:
- Fixed a few bugs that could cause ksh to show the wrong error message and/or
return the wrong exit status if a command couldn't be executed. In
scenarios where the command was found in the PATH but it was not executable,
ksh now returns with exit status 126. Otherwise, ksh will return with exit
status 127 (such as if the command isn't found or if the command name is
too long).
2021-04-12:
- Corrected a memory fault when an attempt was made to unset the default
nameref KSH_VERSION from the shell environment prior to any other name
reference variable creation or modification.
2021-04-11:
- Fixed two related regressions introduced on 2020-06-16:
1. The += assignment failed to append the value of variables when used
in an invocation-local scope. The following should print '5', but
the regression resulted in '3' being printed instead:
$ integer foo=2; foo+=3 command eval 'echo $foo'
3
2. Any += assignment used in an invocation-local scope could modify
readonly variables.
2021-04-10:
- Fixed: the internal count of the recursion level for arithmetic expressions
was not reset when certain errors occurred in a virtual subshell. This could
cause an erroneous "recursion to deep" error when a loop executed many
subshells containing arithmetic expressions with errors, e.g. for testing.
2021-04-09:
- Fixed a bug that caused ksh to enable -c during the shell's initialization
if the only argument passed was --posix.
- Fixed a related bug that caused 'set --posix' to leave the braceexpand and
letoctal shell options unchanged.
- Fixed a bug that caused 'set --default' to unset the restricted option
in restricted shells.
2021-04-08:
- Path-bound builtins will now be used by restricted shells if /opt/ast/bin
is in the $PATH upon invoking the shell or before setting it to restricted.
- Fixed a bug that caused "printf '%T\n' now" to ignore $LC_ALL and $LC_TIME
if the current locale was previously set, unset then set again.
2021-04-07:
- The $LC_TIME variable is now recognized by ksh and if set to an invalid
locale will show an error.
- Fixed BUG_CSUBSTDO: If standard output is closed before running a command
substitution, redirecting any other file descriptor no longer closes standard
output inside of the command substitution.
2021-04-05:
- Fixed a regression, introduced in ksh 93t+ 2009-07-31, that caused a command
like 'unset arr[3]' to unset not just element 3 of the array but all elements
starting from 3, if a range expansion like ${arr[5..10]} was previously used.
- Several fixes for arrays of a type created by 'enum' were backported from ksh
93v-, further to the two enum array fixes already applied on 2021-02-01:
1. The array[@]} expansion was fixed for associative arrays of an enum type.
2. Assignments now work correctly for all enum values for both indexed and
associative arrays.
3. 'unset' will now completely unset an associative array of an enum type.
2021-04-04:
- A bug was fixed that caused a broken prompt display upon redrawing the
command line if the last line of the prompt includes an xterm escape
sequence that is terminated by $'\a' (the bell character).
- Harden readonly variables. Readonly variables or arrays no longer allow
attribute changes which would otherwise allow their value to be altered.
Expanded support for readonly variables within multidimensional arrays.
2021-04-03:
- Fixed a bug that caused the uname builtin's -d option to change the output
of the -o option.
- Fixed a possible crash that could occur when showing the domain name
with the uname builtin's -d option.
2021-03-31:
- Fixed a bug that caused 'cd -' to ignore the current value of $OLDPWD
when it's set to a different directory in a new scope.
- Fixed a related bug that caused ksh to use the wrong value for $PWD
when in a new scope.
2021-03-29:
- Fixed an intermittent crash that could occur in vi mode when using the 'b'
or 'B' commands to go back one word.
2021-03-27:
- The 'test' builtin will now show an error message when given the invalid ']]'
or '=~' operators; it also properly returns with exit status 2 now (instead
of exit status 1). If the invalid operator is supported by [[ ... ]] (such
as '=~'), test will now suggest the usage of [[ ... ]] instead.
2021-03-22:
- A new --globcasedetect shell option is added to ksh on OSs where we can check
for a case-insensitive file system (currently macOS, Windows/Cygwin, Linux
and QNX 7.0+). When this option is turned on, file name generation
(globbing), as well as file name tab completion on interactive shells,
automatically become case-insensitive on file systems where the difference
between upper- and lowercase is ignored for file names. This is transparently
determined for each directory, so a path pattern that spans multiple file
systems can be part case-sensitive and part case-insensitive.
The option is not compiled into ksh on systems where we do not know of a
method to check for file system case insensitivity. The shell option can be
force-compiled by setting SHOPT_GLOBCASEDET to 1 in src/cmd/ksh93/SHOPT.sh,
but it won't have any effect on non-supported systems, so this is not
recommended. It can be removed from ksh by setting SHOPT_GLOBCASEDET to 0.
2021-03-17:
- Fixed a bug with file name completion on the interactive shell in multibyte
locales. Upon encountering two filenames with multibyte characters starting
with the same byte, a partial multibyte character was autocompleted.
2021-03-16:
- Tilde expansion can now be extended or modified by defining a .sh.tilde.get
or .sh.tilde.set discipline function. This replaces a 2004 undocumented
attempt to add this functionality via a .sh.tilde built-in, which never
worked and crashed the shell. See the manual for details on the new method.
- Fixed a bug in interactive shells: if a variable used by the shell called
a discipline function (such as PS1.get() or COLUMNS.set()), the value of $?
was set to the exit status of the discipline function instead of the last
command run.
2021-03-15:
- If the HOME variable is unset, the bare tilde ~ now expands to the current
user's system-configured home directory instead of merely the username.
- Tighten up potential invalid typeset attribute combos when more than
one numeric type has been requested. In particular, -F and -i are no
longer masked over by previously given float types.
2021-03-13:
- Fixed a file descriptor leak that occurred when ksh used /dev/fd for
process substitutions passed to functions.
- Fixed a separate file descriptor leak that happened when a process
substitution was passed to a nonexistent command.
2021-03-11:
- Fixed an intermittent bug that caused process substitutions to infinitely
loop in Linux virtual machines that use systemd.
- Fixed a bug that caused process substitutions to leave lingering processes
if the command invoking them never reads from them.
2021-03-09:
- The ${!foo@} and ${!foo*} expansions yield variable names beginning with foo,
but excluded 'foo' itself. The fix for this is now backported from 93v- beta.
- test -v var, [ -v var ], and [[ -v var ]] did not correctly test if a
variable is set or unset after it has been given a numeric attribute with
'typeset' but not yet assigned a value. This has been fixed so that
[[ -v var ]] is now equivalent to [[ -n ${var+set} ]] as documented.
2021-03-07:
- Fixed the typeset -p display of short integers without an assigned value.
Also, the last -s or -l attribute option supplied for an integer is used.
- Fixed a bug with -G/--globstar introduced on 2020-08-09: patterns did not
match anything if any pathname component was '.' or '..', e.g. '**/./glob.c'
never matched. The 2020-08-09 fix does still apply to patterns like '.*'.
- Enhancement to -G/--globstar: symbolic links to directories are now followed
if they match a normal (non-**) glob pattern. For example, if '/lnk' is a
symlink to a directory, '/lnk/**' and '/l?k/**' now work as you would expect.
- Fixed a bug introduced on 2021-02-11 that caused job control on interactive
ksh sessions to misbehave if the login shell was replaced by ksh using 'exec'.
2021-03-06:
- Fixed an old expansion bug: expansions of type ${var=value} and ${var:=value}
did not perform an assignment and yielded the value 0 if 'var' was typeset as
numeric (integer or float) but had not yet been assigned a value.
- Fixed a bug introduced on 2020-08-19: Ctrl+D would break after an
interactive shell received SIGWINCH.
- Fixed a bug introduced on 2020-05-21: on an interactive shell, command lines
containing a syntax error were not added to the command history file and
sometimes corrupted the command history.
2021-03-05:
- Unbalanced quotes and backticks now correctly produce a syntax error
in -c scripts, 'eval', and backtick-style command substitutions.
2021-03-04:
- Fixed an arbitrary command execution vulnerability that occurred when
parsing the subscripts of arrays within arithmetic commands and expansion.
2021-03-01:
- Fixed the retention of size attributes when 'readonly' or 'typeset -r'
was applied to an existing variable.
2021-02-26:
- Fixed three long-standing bugs with tab completion in the emacs editor:
1. The editor accepted literal tabs without escaping in certain cases,
causing buggy and inconsistent completion behaviour. Details:
https://github.com/ksh93/ksh/issues/71#issuecomment-656970959
https://github.com/ksh93/ksh/issues/71#issuecomment-657216472
To enter a literal tab in emacs, you need to escape it with ^V or \.
2. After completing a filename by choosing from a file completion menu,
the terminal cursor was placed one position too far to the right,
corrupting command line display. This happened with multiline active.
Details: https://github.com/ksh93/ksh/issues/71#issue-655093805
3. A completion menu was displayed if the file name to be completed was
at the point where the rest of it started with a number, even if that
part uniquely identified it so the menu only showed one item. Details:
https://www.mail-archive.com/ast-users@lists.research.att.com/msg00436.html
- A bug with ${.sh.fun} in combination with the DEBUG trap has been fixed.
The ${.sh.fun} variable wrongly continued to contain the name of the last
function executed by the DEBUG trap after the trap action completed.
2021-02-21:
- Fixed: The way that SIGWINCH was handled (i.e. the signal emitted when the
terminal window size changes) could cause strange emacs/vi editor behaviour.
2021-02-20:
- Fixed a bug introduced on 2021-01-20: if a DEBUG trap action yielded exit
status 2, the execution of the next command was not skipped as documented.
- Fixed multiple buffer overflows causing crashes in typeset -L/-R-/-Z.
- Fixed typeset -Z zero-filling: if the number was zero, all zeros
were skipped when changing the initial size value of the -Z attribute,
leaving an empty string.
2021-02-18:
- A bug was fixed in the 'read' builtin that caused it to fail to process
multibyte characters properly in Shift-JIS locales.
2021-02-17:
- Emacs mode fixes:
1. Erasing a backslash while doing a reverse search (^R) no longer deletes
extra characters.
2. The backslash now escapes a subsequent interrupt (^C) as documented.
- Fixed a longstanding bug with shared-state command substitutions of the form
${ command; }. If these were executed in a subshell, changes made within
could survive not only the command substitution but also the parent subshell.
2021-02-15:
- Fixed a regression introduced by ksh93 (was not in ksh88): an empty 'case'
list on a single line ('case x in esac') was a syntax error.
- Fixed a bug in the emacs built-in editor, introduced on 2020-09-17, that
made the Meta-D and Meta-H keys delete single characters instead of words.
- A new 'backslashctrl' shell option has been added. It is on by default.
Turning it off (set +o backslashctrl or set --nobackslashctrl) disables the
special escaping behaviour of the backslash character in the emacs and vi
built-in editors. Particularly in the emacs editor, this makes it much easier
to go back, insert a forgotten backslash into a command, and then continue
editing without having your next cursor key replace your backslash with
garbage. Note that Ctrl+V (or whatever other character was set using
'stty lnext') always escapes all control characters in either editing mode.
2021-02-14:
- Due to a deficiency in some UNIX variants, the 'sleep' built-in command could
occasionally sleep for slightly less than the time specified. It now performs
an additional check against the system clock to make sure it sleeps at least
the given amount of time. Thanks to Lev Kujawski for adding this feature.
- A few bugs were fixed that 93u+m introduced along with the new '-o posix'
shell option on 2020-09-01:
1. 'set --posix' now works as the expected equivalent of 'set -o posix'.
2. As of 2020-09-18, the posix option turns off braceexpand and turns on
letoctal. Any attempt to override that in a single command such as
'set -o posix +o letoctal' was quietly ignored. This now works as long
as the overriding option follows the posix option on the command line.
3. The --default option to 'set' now stops the 'posix' option, if set or
unset in the same 'set' command, from changing other options. This allows
the command output by 'set +o' to correctly restore the current options.
2021-02-11:
- Fixed a bug that caused ksh to lose track of all running background jobs if
a shared-state command substitution of the form v=${ cmd; } was used twice.
- Job control (the -m/-o monitor option) has been fixed for scripts. Background
jobs are now correctly assigned their own process group when run from
subshells (except command substitutions). The 'fg' command now also works for
scripts as it does on other shells, though 'wait' should be preferred.
2021-02-05:
- Fixed a longstanding bug that caused redirections that store a file
descriptor > 10 in a variable, such as {var}>file, to stop working if
brace expansion (the -B or -o braceexpand option) was turned off. (Note
that '{var}' is not a brace expansion as it does not contain ',' or '..'.)
2021-02-04:
- Fixed ksh crashing if an autoloaded function tried to autoload itself.
ksh now errors out gracefully with an "autoload loop" error message.
- Fixed crash on trying a very long nonexistent command.
2021-02-01:
- Fixed a bug in 'typeset': the '-s' modifier option for short integer will
now only be applied if the integer option '-i' is also present, avoiding
inconsistent results and a crash.
- Fixed: scalar arrays (-a) and associative arrays (-A) of a type created by
'enum' allowed values not specified by the enum type, corrupting results.
- Fixed: the "${array[@]}" expansion for associative arrays of a type created
by 'enum' expanded to random numbers instead of the array's values.
2021-01-30:
- The -x option to the 'command' built-in now causes it to bypass built-ins
@@ -12,7 +784,7 @@ Any uppercase BUG_* names are modernish shell bug IDs.
a command with many arguments was divided into several command invocations.
- The 2020-08-16 fix is improved with a compile-time feature test that
detects if and how the OS uses data alignment in the arguments list,
detects if the OS requires extra bytes per argument in the arguments list,
maximising the efficiency of 'command -x' for the system it runs on.
2021-01-24:
@@ -342,7 +1114,7 @@ Any uppercase BUG_* names are modernish shell bug IDs.
- Added the '${.sh.pid}' variable as an alternative to Bash's '$BASHPID'.
This variable is set to the current shell's PID, unlike '$$' (which is
set to the parent shell's PID). In virtual subshells '${.sh.pid}' is not
set to the main shell's PID). In virtual subshells '${.sh.pid}' is not
changed from its previous value, while in forked subshells '${.sh.pid}'
is set to the subshell's process ID.
@@ -610,8 +1382,8 @@ Any uppercase BUG_* names are modernish shell bug IDs.
$RANDOM
$LINENO
- Fixed two bugs that caused `unset .sh.lineno` to always produce a memory
fault and `(unset .sh.level)` to memory fault when run in nested
- Fixed two bugs that caused 'unset .sh.lineno' to always produce a memory
fault and '(unset .sh.level)' to memory fault when run in nested
functions.
2020-06-18:
@@ -656,7 +1428,7 @@ Any uppercase BUG_* names are modernish shell bug IDs.
2020-06-13:
- Fixed a timezone name determination bug on FreeBSD that caused the
output from `LC_ALL=C printf '%T' now` to print the wrong time zone name.
output from "LC_ALL=C printf '%T\n' now" to print the wrong time zone name.
2020-06-11:
@@ -703,14 +1475,14 @@ Any uppercase BUG_* names are modernish shell bug IDs.
Emacs editing mode is bugged in ksh93u+ and ksh2020. Let's
say you were to run the following commands after starting
a fresh instance of ksh:
$ alias foo='true'
$ alias foo=true
$ unalias foo
If you type 'a' and then press the up arrow on your keyboard,
ksh will complete 'a' to `alias foo='true'` by doing a reverse
ksh will complete 'a' to 'alias foo=true' by doing a reverse
search for the last command that starts with 'a'.
Run the alias command again, then type 'u' and press the up
arrow key again. If ksh is in Vi mode, you will get `unalias foo`,
but in Emacs mode you will get `alias foo='true'` again.
arrow key again. If ksh is in Vi mode, you will get 'unalias foo',
but in Emacs mode you will get 'alias foo=true' again.
All subsequent commands were ignored as ksh was saving the first
command and only based later searches off of it.