|
|
2642b8 |
diff -up ksh-20120801/src/cmd/ksh93/sh/macro.c.fd2lost ksh-20120801/src/cmd/ksh93/sh/macro.c
|
|
|
2642b8 |
--- ksh-20120801/src/cmd/ksh93/sh/macro.c.fd2lost 2014-01-22 16:23:21.211658984 +0100
|
|
|
2642b8 |
+++ ksh-20120801/src/cmd/ksh93/sh/macro.c 2014-01-22 16:23:21.243658703 +0100
|
|
|
2642b8 |
@@ -391,7 +391,7 @@ void sh_machere(Shell_t *shp,Sfio_t *inf
|
|
|
2642b8 |
break;
|
|
|
2642b8 |
}
|
|
|
2642b8 |
case S_PAR:
|
|
|
2642b8 |
- comsubst(mp,(Shnode_t*)0,1);
|
|
|
2642b8 |
+ comsubst(mp,(Shnode_t*)0,3);
|
|
|
2642b8 |
break;
|
|
|
2642b8 |
case S_EOF:
|
|
|
2642b8 |
if((c=fcfill()) > 0)
|
|
|
2642b8 |
@@ -1165,7 +1165,7 @@ retry1:
|
|
|
2642b8 |
case S_PAR:
|
|
|
2642b8 |
if(type)
|
|
|
2642b8 |
goto nosub;
|
|
|
2642b8 |
- comsubst(mp,(Shnode_t*)0,1);
|
|
|
2642b8 |
+ comsubst(mp,(Shnode_t*)0,3);
|
|
|
2642b8 |
return(1);
|
|
|
2642b8 |
case S_DIG:
|
|
|
2642b8 |
var = 0;
|
|
|
2642b8 |
diff -up ksh-20120801/src/cmd/ksh93/sh/subshell.c.fd2lost ksh-20120801/src/cmd/ksh93/sh/subshell.c
|
|
|
2642b8 |
--- ksh-20120801/src/cmd/ksh93/sh/subshell.c.fd2lost 2014-01-22 16:23:21.222658887 +0100
|
|
|
2642b8 |
+++ ksh-20120801/src/cmd/ksh93/sh/subshell.c 2014-01-22 16:23:21.243658703 +0100
|
|
|
2642b8 |
@@ -122,7 +122,8 @@ void sh_subtmpfile(Shell_t *shp)
|
|
|
2642b8 |
else if(errno!=EBADF)
|
|
|
2642b8 |
errormsg(SH_DICT,ERROR_system(1),e_toomany);
|
|
|
2642b8 |
/* popping a discipline forces a /tmp file create */
|
|
|
2642b8 |
- sfdisc(sfstdout,SF_POPDISC);
|
|
|
2642b8 |
+ if(shp->comsub != 1)
|
|
|
2642b8 |
+ sfdisc(sfstdout,SF_POPDISC);
|
|
|
2642b8 |
if((fd=sffileno(sfstdout))<0)
|
|
|
2642b8 |
{
|
|
|
2642b8 |
/* unable to create the /tmp file so use a pipe */
|
|
|
2642b8 |
@@ -635,6 +636,13 @@ Sfio_t *sh_subshell(Shell_t *shp,Shnode_
|
|
|
2642b8 |
}
|
|
|
2642b8 |
else
|
|
|
2642b8 |
{
|
|
|
2642b8 |
+ if(comsub!=1 && shp->spid)
|
|
|
2642b8 |
+ {
|
|
|
2642b8 |
+ job_wait(shp->spid);
|
|
|
2642b8 |
+ if(shp->pipepid==shp->spid)
|
|
|
2642b8 |
+ shp->spid = 0;
|
|
|
2642b8 |
+ shp->pipepid = 0;
|
|
|
2642b8 |
+ }
|
|
|
2642b8 |
/* move tmp file to iop and restore sfstdout */
|
|
|
2642b8 |
iop = sfswap(sfstdout,NIL(Sfio_t*));
|
|
|
2642b8 |
if(!iop)
|
|
|
2642b8 |
diff -up ksh-20120801/src/cmd/ksh93/sh/xec.c.fd2lost ksh-20120801/src/cmd/ksh93/sh/xec.c
|
|
|
2642b8 |
--- ksh-20120801/src/cmd/ksh93/sh/xec.c.fd2lost 2014-01-22 16:23:21.237658756 +0100
|
|
|
2642b8 |
+++ ksh-20120801/src/cmd/ksh93/sh/xec.c 2014-01-22 16:38:36.374666019 +0100
|
|
|
2642b8 |
@@ -1756,6 +1756,8 @@ int sh_exec(register const Shnode_t *t,
|
|
|
2642b8 |
nlock--;
|
|
|
2642b8 |
job_unlock();
|
|
|
2642b8 |
}
|
|
|
2642b8 |
+ if(shp->subshell)
|
|
|
2642b8 |
+ shp->spid = parent;
|
|
|
2642b8 |
if(type&FPCL)
|
|
|
2642b8 |
sh_close(shp->inpipe[0]);
|
|
|
2642b8 |
if(type&(FCOOP|FAMP))
|
|
|
2642b8 |
@@ -1771,7 +1773,11 @@ int sh_exec(register const Shnode_t *t,
|
|
|
2642b8 |
if(shp->pipepid)
|
|
|
2642b8 |
shp->pipepid = parent;
|
|
|
2642b8 |
else
|
|
|
2642b8 |
+ {
|
|
|
2642b8 |
job_wait(parent);
|
|
|
2642b8 |
+ if(parent==shp->spid)
|
|
|
2642b8 |
+ shp->spid = 0;
|
|
|
2642b8 |
+ }
|
|
|
2642b8 |
if(shp->topfd > topfd)
|
|
|
2642b8 |
sh_iorestore(shp,topfd,0);
|
|
|
2642b8 |
if(usepipe && tsetio && subdup && unpipe)
|