1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

Remove .sh.dollar (re: 3613da42, 7b0e0776)

The undocumented .sh.dollar variable was a hack used to change the
value of $$ (main shell's PID); any value assigned to .sh.dollar
overrides the value of $$. This was used by libcoshell and by the
pre-fork(2) code to update the value of $$ in child processes
initialised by internally generated shell scripts. Both were
removed long ago, so we don't need this.
This commit is contained in:
Martijn Dekker 2022-07-27 17:21:05 +02:00
parent eea3ca3fd1
commit 305073af9d
4 changed files with 17 additions and 21 deletions

View file

@ -92,7 +92,6 @@ const struct shtable2 shtab_variables[] =
".sh.subscript",0, (char*)0,
".sh.value", 0, (char*)0,
".sh.version", NV_NOFREE, (char*)(&e_version[10]),
".sh.dollar", 0, (char*)0,
".sh.match", 0, (char*)0,
".sh.command", 0, (char*)0,
".sh.file", 0, (char*)0,

View file

@ -102,19 +102,18 @@ extern void sh_save_rand_seed(struct rand *, int);
#define SH_SUBSCRNOD (sh.bltin_nodes+50)
#define SH_VALNOD (sh.bltin_nodes+51)
#define SH_VERSIONNOD (sh.bltin_nodes+52)
#define SH_DOLLARNOD (sh.bltin_nodes+53)
#define SH_MATCHNOD (sh.bltin_nodes+54)
#define SH_COMMANDNOD (sh.bltin_nodes+55)
#define SH_PATHNAMENOD (sh.bltin_nodes+56)
#define SH_FUNNAMENOD (sh.bltin_nodes+57)
#define SH_SUBSHELLNOD (sh.bltin_nodes+58)
#define SH_LEVELNOD (sh.bltin_nodes+59)
#define SH_LINENO (sh.bltin_nodes+60)
#define SH_STATS (sh.bltin_nodes+61)
#define SH_MATHNOD (sh.bltin_nodes+62)
#define SH_JOBPOOL (sh.bltin_nodes+63)
#define SH_PIDNOD (sh.bltin_nodes+64)
#define SH_TILDENOD (sh.bltin_nodes+65)
#define SHLVL (sh.bltin_nodes+66)
#define SH_MATCHNOD (sh.bltin_nodes+53)
#define SH_COMMANDNOD (sh.bltin_nodes+54)
#define SH_PATHNAMENOD (sh.bltin_nodes+55)
#define SH_FUNNAMENOD (sh.bltin_nodes+56)
#define SH_SUBSHELLNOD (sh.bltin_nodes+57)
#define SH_LEVELNOD (sh.bltin_nodes+58)
#define SH_LINENO (sh.bltin_nodes+59)
#define SH_STATS (sh.bltin_nodes+60)
#define SH_MATHNOD (sh.bltin_nodes+61)
#define SH_JOBPOOL (sh.bltin_nodes+62)
#define SH_PIDNOD (sh.bltin_nodes+63)
#define SH_TILDENOD (sh.bltin_nodes+64)
#define SHLVL (sh.bltin_nodes+65)
#endif /* SH_VALNOD */

View file

@ -2785,9 +2785,7 @@ static char *special(register int c)
return(ltos(sh.bckpid));
break;
case '$':
if(nv_isnull(SH_DOLLARNOD))
return(ltos(sh.pid));
return(nv_getval(SH_DOLLARNOD));
return(ltos(sh.pid));
case '-':
return(sh_argdolminus(sh.arg_context));
case '?':

View file

@ -1007,7 +1007,7 @@ set -- $(
[[ -n $varname && $varname != '.sh' ]] && print -r -- "$varname"
done
)
(($# >= 65)) || err_exit "could not read shtab_variables[]; adjust test script ($# items read)"
(($# >= 64)) || err_exit "could not read shtab_variables[]; adjust test script ($# items read)"
# ... unset
$SHELL -c '
@ -1102,10 +1102,10 @@ $SHELL -c '
typeset -l lower
errors=0
PS1=/dev/null/test_my_case_too
PS2=$PS1 PS3=$PS1 PS4=$PS1 OPTARG=$PS1 IFS=$PS1 FPATH=$PS1 FIGNORE=$PS1 CSWIDTH=$PS1
PS2=$PS1 PS3=$PS1 PS4=$PS1 OPTARG=$PS1 IFS=$PS1 FPATH=$PS1 FIGNORE=$PS1
for var
do case $var in
RANDOM | HISTCMD | _ | SECONDS | LINENO | JOBMAX | .sh.stats)
RANDOM | HISTCMD | _ | SECONDS | LINENO | JOBMAX | .sh.stats | .sh.match)
# these are expected to fail below as their values change; just test against crashing
typeset -u "$var"
typeset -l "$var"