1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-24 15:04:13 +00:00
cde/src/cmd/ksh93/include
Martijn Dekker 921bbcaeb7 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
2020-09-01 06:19:19 +01:00
..
argnod.h 4 typo fixes: be use => be used 2020-07-05 07:48:01 +02:00
builtins.h Remove SHOPT_BASH; keep &> redir operator, '-o posix' option 2020-09-01 06:19:19 +01:00
defs.h Remove SHOPT_BASH; keep &> redir operator, '-o posix' option 2020-09-01 06:19:19 +01:00
edit.h Fix 80 typos in comments 2020-06-12 01:45:12 +02:00
env.h Fix 80 typos in comments 2020-06-12 01:45:12 +02:00
fault.h Fix 80 typos in comments 2020-06-12 01:45:12 +02:00
fcin.h Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
history.h Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
io.h Remove SHOPT_BASH; keep &> redir operator, '-o posix' option 2020-09-01 06:19:19 +01:00
jobs.h Fix crash upon running many subshells (#113) 2020-08-12 18:50:59 +01:00
lexstates.h Fix 80 typos in comments 2020-06-12 01:45:12 +02:00
name.h Fix 'whence -a' to print correct path for tracked alias (#25) 2020-06-19 14:03:58 +02:00
national.h Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
nval.h nval.h: remove dtksh additions & old compat redefs (re: e2d1b593) 2020-08-17 23:11:51 +01:00
path.h remove unused 'is an exported alias' message (re: 80d9ae2b) 2020-07-19 06:21:14 +01:00
regress.h Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
shell.h Fix crash upon running many subshells (#113) 2020-08-12 18:50:59 +01:00
shlex.h Remove SHOPT_BASH; keep &> redir operator, '-o posix' option 2020-09-01 06:19:19 +01:00
shnodes.h Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
shtable.h Make the 'history' and 'r' commands builtins (#76) 2020-07-16 18:56:49 +01:00
streval.h Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
terminal.h Fixes for implicit declaration warnings 2020-06-14 09:55:08 -04:00
test.h restore 'test --man --' oddness (re: fa6a180f) 2020-08-31 23:43:22 +01:00
timeout.h Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
ulimit.h Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
variables.h Add ${.sh.pid} as an alternative to $BASHPID (#109) 2020-08-07 02:53:25 +01:00
version.h Remove SHOPT_BASH; keep &> redir operator, '-o posix' option 2020-09-01 06:19:19 +01:00