xref: /titanic_52/usr/src/contrib/ast/src/cmd/ksh93/COMPATIBILITY (revision 906afcb89d0412cc073b95c2d701a804a8cdb62c)
1
2		KSH-93 VS. KSH-88
3
4
5The following is a list of known incompatibilities between ksh-93 and ksh-88.
6I have not include cases that are clearly bugs in ksh-88.  I also have
7omitted features that are completely upward compatible.
8
91.	Functions, defined with name() with ksh-93 are compatible with
10	the POSIX standard, not with ksh-88.  No local variables are
11	permitted, and there is no separate scope.  Functions defined
12	with the function name syntax, maintain compatibility.
13	This also affects function traces.
14
152.	! is now a reserved word.  As a result, any command by that
16	name will no longer work with ksh-93.
17
183.	The -x attribute of alias and typeset -f is no longer
19	effective and the ENV file is only read for interactive
20	shells.  You need to use FPATH to make function definitions
21	visible to scripts.
22
234.	A built-in command named command has been added which is
24	always found before the PATH search.  Any script which uses
25	this name as the name of a command (or function) will not
26	be compatible.
27
285.	The output format for some built-ins has changed.  In particular
29	the output format for set, typeset and alias now have single
30	quotes around values that have special characters.  The output
31	for trap without arguments has a format that can be used as input.
32
336.	With ksh-88, a dollar sign ($') followed by a single quote was
34	interpreted literally.  Now it is an ANSI-C string.  You
35	must quote the dollar sign to get the previous behavior.
36	Also, a $ in front of a " indicates that the string needs
37	to be translated for locales other than C or POSIX.  The $
38	is ignored in the C and POSIX locale.
39
407.	With ksh-88, tilde expansion did not take place inside ${...}.
41	with ksh-93, ${foo-~} will cause tilde expansion if foo is
42	not set.  You need to escape the ~ for the previous behavior.
43
448.      Some changes in the tokenizing rules where made that might
45	cause some scripts with previously ambiguous use of quoting
46	to produce syntax errors.
47
489.	Programs that rely on specific exit values for the shell,
49	(rather than 0 or non-zero) may not be compatible.  The
50	exit status for many shell failures has been changed.
51
5210.	Built-ins in ksh-88 were always executed before looking for
53	the command in the PATH variable.  This is no longer true.
54	Thus, with ksh-93, if you have the current directory first
55	in your PATH, and you have a program named test in your
56	directory, it will be executed when you type test; the
57	built-in version will be run at the point /bin is found
58	in your PATH.
59
6011.	Some undocumented combinations of argument passing to ksh
61	builtins no longer works since ksh-93 is getopts conforming
62	with respect to its built-ins.  For example, typeset -8i
63	previously would work as a synonym for typeset -i8.
64
6512.	Command substitution and arithmetic expansion are now performed
66	on PS1, PS3, and ENV when they are expanded.  Thus,  ` and $(
67	as part of the value of these variables must be preceded by a \
68	to preserve their previous behavior.
69
7013.	The ERRNO variable has been dropped.
71
7214.	If the file name following a redirection symbol contain pattern
73	characters they will only be expanded for interactive shells.
74
7515.	The arguments to a dot script will be restored when it completes.
76
7716.	The list of tracked aliases is not displayed with alias unless
78	the -t option is specified.
79
8017.	The POSIX standard requires that test "$arg" have exit status
81	of 0, if and only if $arg is null.  However, since this breaks
82	programs that use test -t, ksh-93 treats an explicit test -t
83	as if the user had entered test -t 1.
84
8518.	The ^T directive of emacs mode has been changed to work the
86	way it does in gnu-emacs.
87
8819.	ksh-88 allowed unbalanced parenthes within ${name op val} whereas
89	ksh-93 does not.  Thus, ${foo-(} needs to be written as ${foo-\(}
90	which works with both versions.
91
9220.     kill -l in ksh-93 lists only the signal names, not their numerical
93	values.
94
9521.	Local variables defined by typeset are statically scoped in
96	ksh-93.  In ksh-88 they were dynamically scoped although this
97	behavior was never documented.
98
9922.	The value of the variable given to getopts is set to ? when
100	the end-of-options is reached to conform to the POSIX standard.
101
10223.	Since the POSIX standard requires that octal constants be
103	recongnized, doing arithmetic on typeset -Z variables can
104	yield different results that with ksh-88.  Most of these
105	differences were eliminated in ksh-93o.  Starting in ksh-93u+, the
106	let command no longer recognizes octal constants starting with 0
107	for compatibility with ksh-88 unless the option letoctal is on.
108
10924.	Starting after ksh-93l, If you run ksh name, where name does
110	not contain a /, the current directory will be searched
111	before doing a path search on name as required by the POSIX
112	shell standard.
113
11425.	In ksh-93, cd - will output the directory that it changes
115	to on standard output as required by X/Open.  With ksh-88,
116	this only happened for interactive shells.
117
11826.	As an undocumented feature of ksh-88, a leading 0 to an
119	assignment of an integer variable caused that variable
120	to be treated as unsigned.  This behavior was removed
121	starting in ksh-93p.
122
12327.	The getopts builtin in ksh-93 requires that optstring contain
124	a leading + to allow options to begin with a +.
125
12628.	In emacs/gmacs mode, control-v will not display the version when
127	the stty lnext character is set to control-v or is unset.
128	The sequence escape control-v will display the shell version.
129
13029.	In ksh-88, DEBUG traps were executed. after each command.  In ksh-93
131	DEBUG traps are exeucted before each command.
132
13330.	In ksh-88, a redirection to a file name given by an empty string was
134	ignored.  In ksh-93, this is an error.
135I am interested in expanding this list so please let me know if you
136uncover any others.
137