cdesktopenv/src/cmd/ksh93/include
Martijn Dekker e3aa32a129 Add --functrace shell option (re: 2a835a2d)
A side effect of the bug fixed in 2a835a2d caused the DEBUG trap
action to appear to be inherited by subshells, but in a buggy way
that could crash the shell. After the fix, the trap is reset in
subshells along with all the others, as it should be. Nonetheless,
as that bug was present for years, some have come to rely on it.

This commit implements that functionality properly. When the new
--functrace option is turned on, DEBUG trap actions are now
inherited by subshells as well as ksh function scopes. In addition,
since it makes logical sense, the new option also causes the
-x/--xtrace option's state to be inherited by ksh function scopes.
Note that changes made within the scope do not propagate upwards;
this is different from bash.

(I've opted against adding a -T short-form equivalent as on bash,
because -T was formerly a different option on 93u+ (see 63c55ad7)
and on mksh it has yet anohter a different meaning. To minimise
confusion, I think it's best to have the long-form name only.)

src/cmd/ksh93/include/shell.h,
src/cmd/ksh93/data/options.c:
- Add new "functrace" (SH_FUNCTRACE) long-form shell option.

src/cmd/ksh93/sh/subshell.c: sh_subshell():
- When functrace is on, copy the parent's DEBUG trap action into
  the virtual subshell scope after resetting the trap actions.

src/cmd/ksh93/sh/xec.c: sh_funscope():
- When functrace is on and xtrace is on in the parent scope, turn
  it on in the child scope.
- Same DEBUG trap action handling as in sh_subshell().

Resolves: https://github.com/ksh93/ksh/issues/162
2022-06-04 17:27:27 +01:00
..
argnod.h Fix the output of `typeset -p` for two dimensional indexed arrays (#454) 2022-02-10 21:01:40 +00:00
builtins.h Update copyright years in files changed since 1st Jan 2022 2022-01-30 20:49:04 +00:00
defs.h Remove more unused stuff 2022-06-03 18:47:15 +01:00
edit.h Update copyright years in files changed since 1st Jan 2022 2022-01-30 20:49:04 +00:00
fault.h Update copyright years in files changed since 1st Jan 2022 2022-01-30 20:49:04 +00:00
fcin.h INIT: remove proto, ratz (re: 46593a89, 6137b99a); major cleanup 2021-12-24 07:05:22 +00:00
history.h Update copyright years in files changed since 1st Jan 2022 2022-01-30 20:49:04 +00:00
io.h Remove more unused stuff 2022-06-03 18:47:15 +01:00
jobs.h trap: fix use after free (#446) 2022-02-05 13:53:11 +00:00
lexstates.h INIT: remove proto, ratz (re: 46593a89, 6137b99a); major cleanup 2021-12-24 07:05:22 +00:00
name.h Honour attribs for assignments preceding sp. builtins, POSIX functs 2022-06-03 23:28:28 +01:00
national.h INIT: remove proto, ratz (re: 46593a89, 6137b99a); major cleanup 2021-12-24 07:05:22 +00:00
nval.h Remove more unused stuff 2022-06-03 18:47:15 +01:00
path.h Yet more misc. cleanups; rm SHOPT_PFSH, SHOPT_TYPEDEF 2022-02-10 21:04:56 +00:00
regress.h Update copyright years in files changed since 1st Jan 2022 2022-01-30 20:49:04 +00:00
shell.h Add --functrace shell option (re: 2a835a2d) 2022-06-04 17:27:27 +01:00
shlex.h Fix the output of `typeset -p` for two dimensional indexed arrays (#454) 2022-02-10 21:01:40 +00:00
shnodes.h Update copyright years in files changed since 1st Jan 2022 2022-01-30 20:49:04 +00:00
shtable.h Update copyright years in files changed since 1st Jan 2022 2022-01-30 20:49:04 +00:00
streval.h Update copyright years in files changed since 1st Jan 2022 2022-01-30 20:49:04 +00:00
terminal.h Update copyright years in files changed since 1st Jan 2022 2022-01-30 20:49:04 +00:00
test.h Update copyright years in files changed since 1st Jan 2022 2022-01-30 20:49:04 +00:00
timeout.h Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
ulimit.h Accumulated fixes for minor issues (#442) 2022-01-30 20:42:59 +00:00
variables.h Update copyright years in files changed since 1st Jan 2022 2022-01-30 20:49:04 +00:00
version.h Add --functrace shell option (re: 2a835a2d) 2022-06-04 17:27:27 +01:00