1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-24 23:14:14 +00:00
cde/src/cmd/ksh93/tests
Martijn Dekker af5f7acf99 Fix bugs related to --posix shell option (re: 921bbcae, f45a0f16)
This fixes the following:
1. 'set --posix' now works as an equivalent of 'set -o posix'.
2. The posix option turns off braceexpand and turns on letoctal.
   Any attempt to override that in a single command such as 'set -o
   posix +o letoctal' was quietly ignored. This now works as long
   as the overriding option follows the posix option in the command.
3. The --default option to 'set' now stops the 'posix' option, if
   set or unset in the same 'set' command, from changing other
   options. This allows the command output by 'set +o' to correctly
   restore the current options.

src/cmd/ksh93/data/builtins.c:
- To make 'set --posix' work, we must explicitly list it in
  sh_set[] as a supported option so that AST optget(3) recognises
  it and won't override it with its own default --posix option,
  which converts the optget(3) string to at POSIX getopt(3) string.
    This means it will appear as a separate entry in --man output,
  whether we want it to or not. So we might as well use it as an
  example to document how --optionname == -o optionname, replacing
  the original documentation that was part of the '-o' description.

src/cmd/ksh93/sh/args.c: sh_argopts():
- Add handling for explitit --posix option in data/builtins.c.
- Move SH_POSIX syncing SH_BRACEEXPAND and SH_LETOCTAL from
  sh_applyopts() into the option parsing loop here. This fixes
  the bug that letoctal was ignored in 'set -o posix +o letoctal'.
- Remember if --default was used in a flag, and do not sync options
  with SH_POSIX if the flag is set. This makes 'set +o' work.

src/cmd/ksh93/include/argnod.h,
src/cmd/ksh93/data/msg.c,
src/cmd/ksh93/sh/args.c: sh_printopts():
- Do not potentially translate the 'on' and 'off' labels in 'set
  -o' output. No other shell does, and some scripts parse these.

src/cmd/ksh93/sh/init.c: sh_init():
- Turn on SH_LETOCTAL early along with SH_POSIX if the shell was
  invoked as sh; this makes 'sh -o' and 'sh +o' show expected
  options (not that anyone does this, but correctness is good).

src/cmd/ksh93/include/defs.h,
src/cmd/ksh93/include/shell.h:
- The state flags were in defs.h and most (but not all) of the
  shell options were in shell.h. Gather all the shell state and
  option flag definitions into one place in shell.h for clarity.
- Remove unused SH_NOPROFILE and SH_XARGS option flags.

src/cmd/ksh93/tests/options.sh:
- Add tests for these bugs.

src/lib/libast/misc/optget.c: styles[]:
- Edit default optget(3) option self-documentation for clarity.

Several changed files:
- Some SHOPT_PFSH fixes to avoid compiling dead code.
2021-02-14 23:51:19 +00:00
..
alias.sh Fix a crash on unsetting preset alias (re: ddaa145b) (#133) 2020-09-18 11:17:20 +01:00
append.sh shtests: cd to each test set's temp dir before running 2020-09-02 06:02:40 +01:00
arith.sh Produce IEEE compliant output from pow() despite platform deviations 2021-02-12 13:23:16 +00:00
arrays.sh shtests: cd to each test set's temp dir before running 2020-09-02 06:02:40 +01:00
arrays2.sh Fix disabling SHOPT_FIXEDARRAY (re: 2182ecfa) 2021-02-10 04:48:56 +00:00
attributes.sh tests/attributes.sh: fix spurious fail if any env var contains 'foo' 2021-02-12 12:45:47 +00:00
basic.sh move exit/return tests from basic.sh to return.sh (re: 092b90da) 2021-02-14 06:32:57 +00:00
bracket.sh github: Re-disable Mac CI runner (re: 5c389035) 2021-02-13 06:58:30 +00:00
builtins.sh tests/builtins.sh: fix fail due to translated system messages 2021-02-13 23:27:43 +00:00
case.sh shtests: cd to each test set's temp dir before running 2020-09-02 06:02:40 +01:00
comvar.sh shtests: cd to each test set's temp dir before running 2020-09-02 06:02:40 +01:00
comvario.sh shtests: cd to each test set's temp dir before running 2020-09-02 06:02:40 +01:00
coprocess.sh regress test tweaks 2020-10-03 00:32:32 +02:00
cubetype.sh shtests: cd to each test set's temp dir before running 2020-09-02 06:02:40 +01:00
enum.sh Correctly block invalid values for arrays of an enum type 2021-02-01 16:57:43 +00:00
exit.sh shtests: cd to each test set's temp dir before running 2020-09-02 06:02:40 +01:00
expand.sh shtests: cd to each test set's temp dir before running 2020-09-02 06:02:40 +01:00
functions.sh sleep: guarantee sleeping specified time at minimum (#174) 2021-02-14 07:27:04 +00:00
glob.sh Fix compile/regress fails on compiling without SHOPT_* options 2021-02-08 22:02:45 +00:00
grep.sh shtests: cd to each test set's temp dir before running 2020-09-02 06:02:40 +01:00
heredoc.sh fix typos: descritor -> descriptor 2020-10-05 18:39:49 +02:00
io.sh Fix exec/redirect (fd != 1) in shared-state comsub (re: db72f41f) 2021-02-13 16:01:42 +00:00
jobs.sh tests/jobs.sh: suppress error msg on noncompliant 'ps' 2021-02-12 23:56:58 +00:00
leaks.sh Implement leak detection on UnixWare (#172) 2021-02-13 00:52:54 +00:00
locale.sh Fix compile/regress fails on compiling without SHOPT_* options 2021-02-08 22:02:45 +00:00
math.sh Fix compile/regress fails on compiling without SHOPT_* options 2021-02-08 22:02:45 +00:00
nameref.sh shtests: cd to each test set's temp dir before running 2020-09-02 06:02:40 +01:00
namespace.sh Fix compile/regress fails on compiling without SHOPT_* options 2021-02-08 22:02:45 +00:00
options.sh Fix bugs related to --posix shell option (re: 921bbcae, f45a0f16) 2021-02-14 23:51:19 +00:00
path.sh command -x: tweak args list size detection (re: 9ddb45b1) 2021-02-13 00:08:33 +00:00
pointtype.sh shtests: cd to each test set's temp dir before running 2020-09-02 06:02:40 +01:00
pty.sh tests/pty.sh: avoid typeahead: add 10ms delay (re: 5c389035) 2021-02-13 14:30:40 +00:00
quoting.sh shtests: cd to each test set's temp dir before running 2020-09-02 06:02:40 +01:00
quoting2.sh shtests: cd to each test set's temp dir before running 2020-09-02 06:02:40 +01:00
readcsv.sh shtests: cd to each test set's temp dir before running 2020-09-02 06:02:40 +01:00
recttype.sh shtests: cd to each test set's temp dir before running 2020-09-02 06:02:40 +01:00
restricted.sh shtests: cd to each test set's temp dir before running 2020-09-02 06:02:40 +01:00
return.sh move exit/return tests from basic.sh to return.sh (re: 092b90da) 2021-02-14 06:32:57 +00:00
select.sh shtests: cd to each test set's temp dir before running 2020-09-02 06:02:40 +01:00
shtests shtests: Stop requiring a tty 2021-02-13 05:55:27 +00:00
sigchld.sh tests/sigchild.sh: increase a sleep to prevent very rare intermittent fail 2020-09-18 20:06:34 +02:00
signal.sh Fix signal/trap behaviour in ksh functions (rhbz#1454804) 2020-09-29 03:16:39 +02:00
statics.sh shtests: cd to each test set's temp dir before running 2020-09-02 06:02:40 +01:00
subshell.sh cd: Fork if $PWD exists but is not actually the PWD (re: d1483150) 2021-01-20 05:56:38 +00:00
substring.sh Fix compile/regress fails on compiling without SHOPT_* options 2021-02-08 22:02:45 +00:00
tilde.sh shtests: cd to each test set's temp dir before running 2020-09-02 06:02:40 +01:00
timetype.sh shtests: cd to each test set's temp dir before running 2020-09-02 06:02:40 +01:00
treemove.sh shtests: cd to each test set's temp dir before running 2020-09-02 06:02:40 +01:00
types.sh typeset: add error msgs for incompatible options; improve usage msg 2021-01-21 09:36:10 +00:00
variables.sh sleep: guarantee sleeping specified time at minimum (#174) 2021-02-14 07:27:04 +00:00
vartree1.sh shtests: cd to each test set's temp dir before running 2020-09-02 06:02:40 +01:00
vartree2.sh shtests: cd to each test set's temp dir before running 2020-09-02 06:02:40 +01:00