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/bltins
Johnothan King bd3e2a8001
Fix unreliable behavior when special vars are readonly or unset (#27)
src/cmd/ksh93/data/variables.c:
 - Running 'unset .sh.lineno' creates a memory fault, so fix that
   by giving it the NV_NOFREE attribute. This crash was happening
   because ${.sh.lineno} is an integer that cannot be freed from
   memory with free(3).

src/cmd/ksh93/sh/init.c:
 - Tell _nv_unset to ignore NV_RDONLY when $RANDOM and $LINENO are
   restored from the subshell scope. This is required to fully
   restore the original state of these variables after a virtual
   subshell finishes.

src/cmd/ksh93/bltins/typeset.c,
src/cmd/ksh93/sh/subshell.c:
 - Disabled some optimizations for two instances of 'sh_assignok' to
   fix 'readonly' in virtual subshells and '(unset .sh.level)' in
   nested functions. This fixes the following variables when
   '(readonly $varname); enum varname=' is run:

   $_
   ${.sh.name}
   ${.sh.subscript}
   ${.sh.level}

   The optimization in question prevents sh_assignok from saving the
   original state of these variables by making the sh_assignok call
   a no-op. Ksh needs the original state of a variable for it to be
   properly restored after a virtual subshell has run, otherwise ksh
   will simply carry over any new flags (being NV_RDONLY in this case)
   from the subshell into the main shell.

src/cmd/ksh93/tests/variables.sh:
 - Add regression tests from Martijn Dekker for setting special
   variables as readonly in virtual subshells and for unsetting
   special variables in general.

Fixes #4
2020-06-20 18:08:41 +01:00
..
alarm.c Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
cd_pwd.c Remove code related to long-dead 3DFS research project 2020-06-12 01:45:17 +02:00
cflow.c Fix regression in 'return' introduced by 98e0fc94 2020-06-12 01:45:17 +02:00
enum.c Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
getopts.c Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
hist.c Remove code related to long-dead 3DFS research project 2020-06-12 01:45:17 +02:00
misc.c Remove 'login' and 'newgrp' builtins: not sane default behaviour 2020-06-12 06:57:57 +02:00
mkservice.c Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
print.c rm "I/O error" error msg; just keep >0 exit status (re: 9011fa93) 2020-06-12 01:45:18 +02:00
read.c read -r -d should not ignore -r 2020-06-16 13:49:23 +01:00
regress.c Fix 47 typos in user-facing help and error messages 2020-06-12 01:45:12 +02:00
sleep.c Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
test.c silence macro redefinition warnings (re: 7003aba4) 2020-06-16 04:51:21 +02:00
trap.c Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
typeset.c Fix unreliable behavior when special vars are readonly or unset (#27) 2020-06-20 18:08:41 +01:00
ulimit.c Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
umask.c Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
whence.c Fix 'whence -a' to print correct path for tracked alias (#25) 2020-06-19 14:03:58 +02:00