1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Remove SH_SUBSHELL option vestiges

Mildly interesting: apparently there was once an idea to implement
shared-state command substitutions as a shell option like 'set -o
subshare'. They were implemented using a new ${ syntax; } instead,
but there is a vestigial SH_SUBSHARE option ID in shell.h plus a
check for it in subshell.c that would cause backtick-style command
substitutions (comsub==1) to share their state. That option isn't
defined in data/options.c so it's impossible for a user to set it.

src/cmd/ksh93/include/shell.h,
src/cmd/ksh93/sh/subshell.c:
- Remove SH_SUBSHELL option vestiges.

src/cmd/ksh93/include/defs.h:
- Correct my comment on 'comsub' flag; I was wrong about what the
  values meant. 2 is for a shared-state comsub. (re: 4ce486a7)
This commit is contained in:
Martijn Dekker 2020-10-01 16:49:10 +02:00
parent d89ef0fafa
commit 7424844df5
3 changed files with 3 additions and 4 deletions

View file

@ -211,8 +211,8 @@ struct shared
unsigned char ignsig; /* ignored signal in subshell */ \
unsigned char lastsig; /* last signal received */ \
char pathinit; /* pathinit called from subshell */ \
char comsub; /* set to 1 when in `` comsub, 2 when in $() comsub */ \
char subshare; /* set when in ${..} comsub */ \
char comsub; /* set to 1 when in `...`, 2 when in ${ ...; }, 3 when in $(...) */ \
char subshare; /* set when comsub==2 (shared-state ${ ...; } command substitution) */ \
char toomany; /* set when out of fd's */ \
char instance; /* in set_instance */ \
char decomma; /* decimal_point=',' */ \

View file

@ -86,7 +86,6 @@ typedef union Shnode_u Shnode_t;
#define SH_GMACS 24
#define SH_EMACS 25
#define SH_PRIVILEGED 26
#define SH_SUBSHARE 27 /* subshell shares state with parent */
#define SH_NOLOG 28
#define SH_NOTIFY 29
#define SH_DICTIONARY 30

View file

@ -523,7 +523,7 @@ Sfio_t *sh_subshell(Shell_t *shp,Shnode_t *t, volatile int flags, int comsub)
job.curpgid = 0;
sp->subshare = shp->subshare;
sp->comsub = shp->comsub;
shp->subshare = comsub==2 || (comsub==1 && sh_isoption(SH_SUBSHARE));
shp->subshare = comsub==2;
if(comsub)
{
shp->comsub = comsub;