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
|
@ -58,11 +58,6 @@
|
|||
#define SYSDOT (shgd->bltin_cmds+20) /* . */
|
||||
#define SYSSOURCE (shgd->bltin_cmds+21) /* source */
|
||||
#define SYSRETURN (shgd->bltin_cmds+22) /* return */
|
||||
#if SHOPT_BASH
|
||||
# define SYSLOCAL (shgd->bltin_cmds+23) /* local */
|
||||
#else
|
||||
# define SYSLOCAL 0
|
||||
#endif
|
||||
|
||||
/* entry point for shell special builtins */
|
||||
|
||||
|
|
|
@ -311,7 +311,6 @@ struct shared
|
|||
#define SH_COMPLETE 19 /* set for command completion */
|
||||
#define SH_INTESTCMD 20 /* set while test/[ command is being run */
|
||||
|
||||
#define SH_BASH 41
|
||||
#define SH_BRACEEXPAND 42
|
||||
#define SH_POSIX 46
|
||||
#define SH_MULTILINE 47
|
||||
|
@ -319,9 +318,7 @@ struct shared
|
|||
#define SH_NOPROFILE 78
|
||||
#define SH_NOUSRPROFILE 79
|
||||
#define SH_LOGIN_SHELL 67
|
||||
#define SH_COMMANDLINE 0x100
|
||||
#define SH_BASHEXTRA 0x200
|
||||
#define SH_BASHOPT 0x400
|
||||
#define SH_COMMANDLINE 0x100 /* flag for invocation-only options ('set -o' cannot change them) */
|
||||
|
||||
#define SH_ID "ksh" /* ksh id */
|
||||
#define SH_STD "sh" /* standard sh id */
|
||||
|
@ -330,44 +327,11 @@ struct shared
|
|||
|
||||
#define SH_TYPE_SH 001
|
||||
#define SH_TYPE_KSH 002
|
||||
#define SH_TYPE_BASH 004
|
||||
#define SH_TYPE_POSIX 004
|
||||
#define SH_TYPE_LOGIN 010
|
||||
#define SH_TYPE_PROFILE 020
|
||||
#define SH_TYPE_RESTRICTED 040
|
||||
|
||||
#if SHOPT_BASH
|
||||
# ifndef SHOPT_HISTEXPAND
|
||||
# define SHOPT_HISTEXPAND 1
|
||||
# endif
|
||||
/*
|
||||
* define for all the bash options
|
||||
*/
|
||||
# define SH_CDABLE_VARS 51
|
||||
# define SH_CDSPELL 52
|
||||
# define SH_CHECKHASH 53
|
||||
# define SH_CHECKWINSIZE 54
|
||||
# define SH_CMDHIST 55
|
||||
# define SH_DOTGLOB 56
|
||||
# define SH_EXECFAIL 57
|
||||
# define SH_EXPAND_ALIASES 58
|
||||
# define SH_EXTGLOB 59
|
||||
# define SH_HOSTCOMPLETE 63
|
||||
# define SH_HUPONEXIT 64
|
||||
# define SH_INTERACTIVE_COMM 65
|
||||
# define SH_LITHIST 66
|
||||
# define SH_MAILWARN 68
|
||||
# define SH_NOEMPTYCMDCOMPL 69
|
||||
# define SH_NOCASEGLOB 70
|
||||
# define SH_NULLGLOB 71
|
||||
# define SH_PHYSICAL 45
|
||||
# define SH_PROGCOMP 72
|
||||
# define SH_PROMPTVARS 73
|
||||
# define SH_RESTRICTED2 74
|
||||
# define SH_SHIFT_VERBOSE 75
|
||||
# define SH_SOURCEPATH 76
|
||||
# define SH_XPG_ECHO 77
|
||||
#endif
|
||||
|
||||
#if SHOPT_HISTEXPAND
|
||||
# define SH_HISTAPPEND 60
|
||||
# define SH_HISTEXPAND 43
|
||||
|
@ -483,7 +447,6 @@ extern const char e_dict[];
|
|||
#define PRINT_VERBOSE 0x01 /* option on|off list */
|
||||
#define PRINT_ALL 0x02 /* list unset options too */
|
||||
#define PRINT_NO_HEADER 0x04 /* omit listing header */
|
||||
#define PRINT_SHOPT 0x08 /* shopt -s|-u */
|
||||
#define PRINT_TABLE 0x10 /* table of all options */
|
||||
|
||||
#ifdef SHOPT_STATS
|
||||
|
|
|
@ -114,15 +114,6 @@ extern const char e_sysprofile[];
|
|||
#if SHOPT_SYSRC
|
||||
extern const char e_sysrc[];
|
||||
#endif
|
||||
#if SHOPT_BASH
|
||||
#if SHOPT_SYSRC
|
||||
extern const char e_bash_sysrc[];
|
||||
#endif
|
||||
extern const char e_bash_rc[];
|
||||
extern const char e_bash_login[];
|
||||
extern const char e_bash_logout[];
|
||||
extern const char e_bash_profile[];
|
||||
#endif
|
||||
extern const char e_stdprompt[];
|
||||
extern const char e_supprompt[];
|
||||
extern const char e_ambiguous[];
|
||||
|
|
|
@ -41,7 +41,6 @@ typedef struct _shlex_
|
|||
int lastline; /* last line number */
|
||||
int lasttok; /* previous token number */
|
||||
int digits; /* numerical value with word token */
|
||||
int nonstandard; /* nonstandard construct in profile */
|
||||
char aliasok; /* on when alias is legal */
|
||||
char assignok; /* on when name=value is legal */
|
||||
char inexec; /* on when processing exec */
|
||||
|
|
|
@ -17,4 +17,4 @@
|
|||
* David Korn <dgk@research.att.com> *
|
||||
* *
|
||||
***********************************************************************/
|
||||
#define SH_RELEASE "93u+m 2020-08-19"
|
||||
#define SH_RELEASE "93u+m 2020-09-01"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue