mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Remove SHOPT_BASH; keep &> redir operator, '-o posix' option
On 16 June there was a call for volunteers to fix the bash compatibility mode; it has never successfully compiled in 93u+. Since no one showed up, it is now removed due to lack of interest. A couple of things are kept, which are now globally enabled: 1. The &>file redirection shorthand (for >file 2>&1). As a matter of fact, ksh93 already supported this natively, but only while running rc/profile/login scripts, and it issued a warning. This makse it globally available and removes the warning, bringing ksh93 in line with mksh, bash and zsh. 2. The '-o posix' standard compliance option. It is now enabled on startup if ksh is invoked as 'sh' or if the POSIXLY_CORRECT variable exists in the environment. To begin with, it disables the aforementioned &> redirection shorthand. Further compliance tweaks will be added in subsequent commits. The differences will be fairly minimal as ksh93 is mostly compliant already. In all changed files, code was removed that was compiled (more precisely, failed to compile/link) if the SHOPT_BASH preprocessor identifier was defined. Below are other changes worth mentioning: src/cmd/ksh93/sh/bash.c, src/cmd/ksh93/data/bash_pre_rc.sh: - Removed. src/cmd/ksh93/data/lexstates.c, src/cmd/ksh93/include/shlex.h, src/cmd/ksh93/sh/lex.c: - Globally enable &> redirection operator if SH_POSIX not active. - Remove warning that was issued when &> was used in rc scripts. src/cmd/ksh93/data/options.c, src/cmd/ksh93/include/defs.h, src/cmd/ksh93/sh/args.c: - Keep SH_POSIX option (-o posix). - Replace SH_TYPE_BASH shell type by SH_TYPE_POSIX. src/cmd/ksh93/sh/init.c: - sh_type(): Return SH_TYPE_POSIX shell type if ksh was invoked as sh (or rsh, restricted sh). - sh_init(): Enable posix option if the SH_TYPE_POSIX shell type was detected, or if the CONFORMANCE ast config variable was set to "standard" (which libast sets on init if POSIXLY_CORRECT exists in the environment). src/cmd/ksh93/tests/options.sh, src/cmd/ksh93/tests/io.sh: - Replace regression tests for &> and move to io.sh. Since &> is now for general use, no longer test in an rc script, and don't check that a warning is issued. Closes: #9 Progresses: #20
This commit is contained in:
parent
84331a96fc
commit
921bbcaeb7
25 changed files with 95 additions and 1148 deletions
|
@ -54,7 +54,6 @@
|
|||
/*
|
||||
* IMPORTANT: The order of these struct members must be synchronous
|
||||
* with the offsets on the macros defined in include/builtins.h!
|
||||
* The order up through "local" is significant.
|
||||
*/
|
||||
const struct shtable3 shtab_builtins[] =
|
||||
{
|
||||
|
@ -81,9 +80,6 @@ const struct shtable3 shtab_builtins[] =
|
|||
".", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(dot_cmd),
|
||||
"source", NV_BLTIN|BLT_ENV, bltin(dot_cmd),
|
||||
"return", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(return),
|
||||
#if SHOPT_BASH
|
||||
"local", NV_BLTIN|BLT_ENV|BLT_SPC|BLT_DCL,bltin(typeset),
|
||||
#endif
|
||||
/*
|
||||
* Builtins without offset macros in include/builtins.h follow.
|
||||
*/
|
||||
|
@ -220,13 +216,6 @@ const char sh_set[] =
|
|||
"[+gmacs?Enables/disables \bgmacs\b editing mode. \bgmacs\b "
|
||||
"editing mode is the same as \bemacs\b editing mode "
|
||||
"except for the handling of \b^T\b.]"
|
||||
#if SHOPT_BASH
|
||||
"[+hashall?Equivalent to \b-h\b and \b-o trackall\b. Available "
|
||||
"in bash compatibility mode only.]"
|
||||
"[+history?Enable command history. Available in bash "
|
||||
"compatibility mode only. On by default in interactive "
|
||||
"shells.]"
|
||||
#endif
|
||||
#if SHOPT_HISTEXPAND
|
||||
"[+histexpand?Equivalent to \b-H\b.]"
|
||||
#endif
|
||||
|
@ -247,20 +236,12 @@ const char sh_set[] =
|
|||
"compatibility.]"
|
||||
"[+notify?Equivalent to \b-b\b.]"
|
||||
"[+nounset?Equivalent to \b-u\b.]"
|
||||
#if SHOPT_BASH
|
||||
"[+onecmd?Equivalent to \b-t\b. Available in bash compatibility "
|
||||
"mode only.]"
|
||||
"[+physical?Equivalent to \b-P\b. Available in bash "
|
||||
"compatibility mode only.]"
|
||||
"[+posix?Turn on POSIX compatibility. Available in bash "
|
||||
"compatibility mode only. Bash in POSIX mode is not the "
|
||||
"same as ksh.]"
|
||||
#endif
|
||||
"[+pipefail?A pipeline will not complete until all components "
|
||||
"of the pipeline have completed, and the exit status "
|
||||
"of the pipeline will be the value of the last "
|
||||
"command to exit with non-zero exit status, or will "
|
||||
"be zero if all commands return zero exit status.]"
|
||||
"[+posix?Enable POSIX standard compatibility mode.]"
|
||||
"[+privileged?Equivalent to \b-p\b.]"
|
||||
"[+rc?Do not run the \b.kshrc\b file for interactive shells.]"
|
||||
"[+showme?Simple commands preceded by a \b;\b will be traced "
|
||||
|
@ -289,9 +270,6 @@ const char sh_set[] =
|
|||
"[x?Execution trace. The shell will display each command after all "
|
||||
"expansion and before execution preceded by the expanded value "
|
||||
"of the \bPS4\b parameter.]"
|
||||
#if SHOPT_BASH
|
||||
"\fbash1\f"
|
||||
#endif
|
||||
#if SHOPT_BRACEPAT
|
||||
"[B?Enable {...} group expansion. On by default.]"
|
||||
#endif
|
||||
|
@ -1569,9 +1547,6 @@ USAGE_LICENSE
|
|||
"[I:regress]:[intercept?Enable the regression test \aintercept\a. Must be "
|
||||
"the first command line option(s).]"
|
||||
#endif
|
||||
#if SHOPT_BASH
|
||||
"\fbash2\f"
|
||||
#endif
|
||||
"\fabc\f"
|
||||
"?"
|
||||
"[T?Enable implementation specific test code defined by mask.]#[mask]"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue