diff --git a/src/cmd/ksh93/COMPATIBILITY b/src/cmd/ksh93/COMPATIBILITY index f994bd2c5..b5520f409 100644 --- a/src/cmd/ksh93/COMPATIBILITY +++ b/src/cmd/ksh93/COMPATIBILITY @@ -1,9 +1,82 @@ + ksh 93u+m vs. ksh 93u+ + +The following is a list of changes between ksh 93u+ 2012-08-01 and the new +ksh 93u+m reboot that could cause incompatibilities in rare corner cases. +Fixes of clear bugs in ksh 93u+ are not included here, even though any bugfix +could potentially cause an incompatibility in a script that relies on the bug. +For more details, see the NEWS file and for complete details, see the git log. + +0. A new '-o posix' shell option has been added to ksh 93u+m that makes + the ksh language more compatible with other shells by following the + POSIX standard more closely. See the manual page for details. It is + enabled by default if ksh is invoked as sh. + +1. File name generation (a.k.a. pathname expansion, a.k.a. globbing) now + never matches the special navigational names '.' (current directory) + and '..' (parent directory). This change makes a pattern like .* + useful; it now matches all hidden 'dotfiles' in the current directory. + +2. The bash-style &>foo redirection operator (shorthand for >foo 2>&1) can + now always be used if -o posix is off, and not only in profile scripts. + +3. Most predefined aliases have been converted to regular built-in + commands that work the same way. 'unalias' no longer removes these. + To remove a built-in command, use 'builtin -d'. The 'history' and 'r' + predefined aliases remain, but are now only set on interactive shells. + There are some minor changes in behaviour in some former aliases: + - 'redirect' now checks if all arguments are valid redirections + before performing them. If an error occurs, it issues an error + message instead of terminating the shell. + - 'suspend' now refuses to suspend a login shell, as there is probably + no parent shell to return to and the login session would freeze. + - 'times' now gives high precision output in a POSIX compliant format. + +4. 'command' no longer expands aliases in its first argument, as this is + no longer required after change 3 above. In the unlikely event that you + still need this behavior, you can set: + alias command='command ' + +5. The undocumented 'login' and 'newgrp' builtin commands have been + removed. These replaced your shell session with the external commands + by the same name, as in 'exec'. If an error occurred (e.g. due to a + typo), you would end up immediately logged out. If you do want this + behavior, you can restore it by setting: + alias login='exec login' + alias newgrp='exec newgrp' + +6. 'case' no longer retries to match patterns as literal strings if they + fail to match as patterns. This undocumented behaviour broke validation + use cases that are expected to work. For example: + n='[0-9]' + case $n in + [0-9]) echo "$n is a number" ;; + esac + would output "[0-9] is a number". In the unlikely event that a script + does rely on this behavior, it can be fixed like this: + case $n in + [0-9] | "[0-9]") + echo "$n is a number or the number pattern" ;; + esac + +7. If 'set -u'/'set -o nounset' is active, then the shell now errors out + if a nonexistent positional parameter such as $1, $2, ... is accessed. + (This does *not* apply to "$@" and "$*".) + +8. If 'set -u'/'set -o nounset' is active, then the shell now errors out + if $! is accessed before the shell has launched any background process. + +9. The 'print', 'printf' and 'echo' builtin commands now return a nonzero + exit status if an input/output error occurs. + +10. The 'unalias' builtin will now return a non-zero status if it tries to + remove a previously set alias that is not currently set. + +____________________________________________________________________________ KSH-93 VS. KSH-88 - The following is a list of known incompatibilities between ksh-93 and ksh-88. -I have not include cases that are clearly bugs in ksh-88. I also have +I have not included cases that are clearly bugs in ksh-88. I also have omitted features that are completely upward compatible. 1. Functions, defined with name() with ksh-93 are compatible with diff --git a/src/cmd/ksh93/README b/src/cmd/ksh93/README index b94131bdc..e8dc6eb30 100644 --- a/src/cmd/ksh93/README +++ b/src/cmd/ksh93/README @@ -6,16 +6,13 @@ ksh-93 has been compiled and run on several machines with several operating systems. The end of this file contains a partial list of operating systems and machines that ksh-93 has been known to run on. -The layout of files for ksh-93 has changed somewhat since ksh-88, -the last major release. Most of the source code for ksh remains in -the sh directory. However, the shell editing and history routines -are in the edit sub-directory. The code for shell built-ins is -in the bltins directory. The data directory contains read-only -data tables and messages that are used by the shell. The include -files remain in the include directory and the shlib directory -is gone. The features directory replaces the older install -directory. The method for generating systems specific feature -information has changed substantially. +Most of the source code for ksh is in the src/cmd/ksh93/sh +directory. For information on what's where, see the file DESIGN. + +A new '-o posix' shell option has been added to ksh 93u+m that makes the +ksh language more compatible with other shells by following the POSIX +standard more closely. See the manual page for details. It is enabled by +default if ksh is invoked as sh, otherwise it is disabled by default. The Makefile file contains several compilation options that can be set before compiling ksh. Options are of the form SHOPT_option and become @@ -82,7 +79,6 @@ The following compile options are set automatically by the feature testing: DEVFD Set when /dev/fd is a directory that names open files. SHELLMAGIC Set on systems that recognize script beginning with #! specially. - VPIX Set on systems the have /usr/bin/vpix program for running MS-DOS. In most instances, you will generate ksh from a higher level directory @@ -107,9 +103,6 @@ a script. ksh93 is able to recognize files in this format and process them as scripts. You can use shcomp to send out scripts when you don't want to give away the original script source. -It is advisable that you put the line PWD=$HOME;export PWD into the -/etc/profile file to reduce initialization time for ksh. - To be able to run setuid/setgid shell scripts, or scripts without read permission, the SUID_EXEC compile option must be on, and ksh must be installed in the /bin directory, the /usr/bin directory, the /usr/lbin directory, @@ -125,10 +118,10 @@ or $ENV file when it the real and effective user/group id's are not equal. The tests sub-directory contains a number of regression tests for ksh. -To run all these tests with the shell you just built, go to the tests -directory and run the command - SHELL=$dir/ksh $dir/ksh shtests -where dir is the directory of the ksh you want to test. +To run all these tests with the shell you just built, run the command + bin/shtests +For help and more options, type + bin/shtests --man The file PROMO.mm is an advertisement that extolls the virtues of ksh. The file sh.1 contains the troff (man) description of this Shell. @@ -165,66 +158,38 @@ this translate() function send mail to the address below. Please report any problems or suggestions to: -dgk@research.att.com +https://github.com/ksh93/ksh -ksh93 has been compiled and alpha tested on the following. An asterisk -signifies that ksh has been installed as /bin/sh on this machine. +ksh 93u+m 1.0.0 has been compiled and alpha tested on the following. +An asterisk signifies minor regression test failures (one or two minor +things amiss), two asterisks signify moderate regression test failures +(some functionality does not work), and three asterisks signify serious +failures (crashes, and/or essential functionality does not work). -* Sun OS 4.1.[123] on sparc. - Sun OS 4.1.1 on sun. - Solaris 2.[1-9] on sparc. - Solaris 2.[4-8] on X86. - HP/UX 8 on HP-9000/730. - HP/UX 9 on HP-9000/730. - HP/UX 10 on HP-9000/857. - HP/UX 11 on pa-risc. - System V Release 3 on Counterpoint C19 - System V Release 4 on AT&T Intel 486. - System V Release 4 on NCR 4850 Intel 486. - IRIX Release 4.0.? System V on SGI-MIPS. - IRIX Release 5.1 System V on SGI-MIPS. - IRIX Release 6.[1-5] System V on SGI-MIPS. - System V Release 3.2 on 3B2. - UTS 5.2.6 on Amdahl 3090,5990,580. - System V Release 3.2 on i386. - SMP_DC.OSx olivetti dcosx MIServer-S 2/128. - SMP_DC.OSx Pyramid dcosx MIServer-S 2/160 r3000. - 4.3BSD on Vax 8650. - AIX release 2 on RS6000. - AIX 3.2 on RS6000. - Linux 1.X on Intel - Linux 2.X on Intel - Linux 2.X on Alpha - Linux 2.X on Alpha - Linux 2.X on OS/390 - Linux 2.X on sparc - Linux 2.4 on intel itanium 64 - Linux Slackware on sparc64 -* Linux ARM on i-PAQ - OSF1 on DEC alpha. - OSF4 on DEC alpha. - UMIPS 4.52 on mips. - BSD-i [2-4] on X86. - OpenBSD on X86 - NetBSD on X86 - FreeBSD on X86 - NeXT on Intel X86. - NeXT on HP. -* Windows NT using UWIN on X86 -* Windows NT using UWIN on alpha - Windows NT using Cygwin on X86 - Windows NT with NutCracker libraries. - Windows NT with Portage libraries. - Windows 3.1 using custom C library. - OpenEdition on MVS - Darwin OS X on PPC - MVS on OS 390 - SCO Openserver 3.2 on X86 - Unixware 7 on X86 +* DragonFly BSD on x86_64 + FreeBSD on x86_64 + GNU/Linux: CentOS on x86_64 + GNU/Linux: Debian on x86_64 + GNU/Linux: Gentoo on i386 + GNU/Linux: NixOS on x86_64 + GNU/Linux: Slackware on x86_64 + GNU/Linux: Ubuntu on x86_64 +*** HP-UX 11 on pa-risc +* illumos: OmniOS 2020-08-19 (gcc) on x86_64 + macOS 10.14.6 (Mojave) on x86_64 +*** NetBSD on x86_64 +** OpenBSD on x86_64 +* Solaris 11.4 (gcc) on x86_64 + Solaris 11.4 (Solaris Studio 12.5 cc) on x86_64 +*** Windows 7 using Cygwin on x86 Good luck!! +The ksh 93u+m contributors +https://github.com/ksh93/ksh + +Originally written by: David Korn dgk@research.att.com