1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00
cde/src/cmd/ksh93/sh
Martijn Dekker f6bc5c03ca nv_setlist(): add check for readonly (re: 264ba48b)
One area where readonly is still ineffective is the local
environment list for a command (preceding assignments) if that
command is not executed using exec(3) after fork(2). Builtin
commands are one example. The following succeeds but should fail:

	(readonly v=1; v=2 true)  # succeeds, but should fail

If the shell is compiled with SHOPT_SPAWN (the default) then this
also applies to external commands invoked with sh_ntfork():

	(readonly v=1; v=2 env)	  # succeeds if SHOPT_SPAWN

This presents to the user as inconsitent behaviour because external
commands may be fork()ed under certain circumstances but not
others, depending on complex optimisations. One example is:

	$ ksh -c 'readonly v=1; v=2 env'
	ksh: v: is read only
	$ ksh -c 'readonly v=1; v=2 env; :'
	(bad: environment list is output, including 'v=2')

In the first command above, where 'v2=env' is the last command in
the -c script, the optimisation skips creating a scope and assigns
the environment list in the current scope.

src/cmd/ksh93/sh/name.c: nv_setlist():
- Add check for readonly. This requires searching for the variable
  in the main tree using nv_search() before a locally scoped one is
  added using nv_open(). Since nv_search() only works with plain
  variable names, temporarily end the string at '='.

src/cmd/ksh93/tests/readonly.sh:
- Add version check and fork the test command substitution subshell
  on older versions that would otherwise abort the tests due to the
  combination of an excessively low arithmetic recursion tolerance
  and a bug that sometimes fails to restore the shell's arithmetic
  recursion level.
2021-04-10 23:12:18 +01:00
..
args.c Fix handling of '--posix' and '--default' (#265) 2021-04-09 23:26:07 +01:00
arith.c Introduce usage of __builtin_unreachable() and noreturn (#248) 2021-04-05 00:28:24 +01:00
array.c Fix more compiler warnings, typos and other minor issues (#260) 2021-04-08 19:58:07 +01:00
defs.c Fix more compiler warnings, typos and other minor issues (#260) 2021-04-08 19:58:07 +01:00
deparse.c Fix various minor problems and update the documentation (#237) 2021-03-21 14:39:03 +00:00
expand.c Add --globcasedetect shell option for globbing and completion 2021-03-22 18:45:19 +00:00
fault.c Fix more compiler warnings, typos and other minor issues (#260) 2021-04-08 19:58:07 +01:00
fcin.c Fix many GCC -Wimplicit-fallthrough warnings (#243) 2021-03-30 21:49:20 +01:00
init.c Fix more compiler warnings, typos and other minor issues (#260) 2021-04-08 19:58:07 +01:00
io.c Backport bugfix for BUG_CSUBSTDO from ksh93v- 2012-08-24 (#259) 2021-04-08 13:24:17 +01:00
jobs.c Fix more compiler warnings, typos and other minor issues (#260) 2021-04-08 19:58:07 +01:00
lex.c lex.c: simplify fmttoken() by using the stack (re: 3255aed2) 2021-04-09 17:36:29 +01:00
macro.c Fix more compiler warnings, typos and other minor issues (#260) 2021-04-08 19:58:07 +01:00
main.c Fix more compiler warnings, typos and other minor issues (#260) 2021-04-08 19:58:07 +01:00
name.c nv_setlist(): add check for readonly (re: 264ba48b) 2021-04-10 23:12:18 +01:00
nvdisc.c Introduce usage of __builtin_unreachable() and noreturn (#248) 2021-04-05 00:28:24 +01:00
nvtree.c Fix various minor problems and update the documentation (#237) 2021-03-21 14:39:03 +00:00
nvtype.c Fix more compiler warnings, typos and other minor issues (#260) 2021-04-08 19:58:07 +01:00
parse.c Fix more compiler warnings, typos and other minor issues (#260) 2021-04-08 19:58:07 +01:00
path.c Fix more compiler warnings, typos and other minor issues (#260) 2021-04-08 19:58:07 +01:00
pmain.c Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
shcomp.c Introduce usage of __builtin_unreachable() and noreturn (#248) 2021-04-05 00:28:24 +01:00
streval.c Hardening of readonly variables (#239) 2021-04-05 06:43:19 +01:00
string.c Fix more compiler warnings, typos and other minor issues (#260) 2021-04-08 19:58:07 +01:00
subshell.c Fix more compiler warnings, typos and other minor issues (#260) 2021-04-08 19:58:07 +01:00
suid_exec.c Fix more compiler warnings, typos and other minor issues (#260) 2021-04-08 19:58:07 +01:00
tdump.c Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
timers.c Introduce usage of __builtin_unreachable() and noreturn (#248) 2021-04-05 00:28:24 +01:00
trestore.c '#if 0' cleanup 2020-08-30 04:51:20 +01:00
waitevent.c Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
xec.c SHOPT_SPAWN: rm unused job control code (re: f207cd57, 41ebb55a) 2021-04-10 18:10:27 +01:00