diff --git a/NEWS b/NEWS index 8ddc9ec84..5fccf2eee 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,9 @@ Any uppercase BUG_* names are modernish shell bug IDs. if they match a normal (non-**) glob pattern. For example, if '/lnk' is a symlink to a directory, '/lnk/**' and '/l?k/**' now work as you would expect. +- Fixed a bug introduced on 2021-02-11 that caused job control on interactive + ksh sessions to misbehave if the login shell was replaced by ksh using 'exec'. + 2021-03-06: - Fixed an old expansion bug: expansions of type ${var=value} and ${var:=value} diff --git a/src/cmd/ksh93/sh/jobs.c b/src/cmd/ksh93/sh/jobs.c index 4c53204ea..e1c664b1d 100644 --- a/src/cmd/ksh93/sh/jobs.c +++ b/src/cmd/ksh93/sh/jobs.c @@ -552,8 +552,8 @@ void job_init(Shell_t *shp, int lflag) job.mypgid = shp->gd->pid; } #ifdef SIGTSTP - possible = (setpgid(0,job.mypgid) >= 0); - if(sh_isoption(SH_INTERACTIVE) && (possible || errno==EPERM)) + possible = (setpgid(0,job.mypgid) >= 0) || errno==EPERM; + if(sh_isoption(SH_INTERACTIVE) && possible) { /* wait until we are in the foreground */ while((job.mytgid=tcgetpgrp(JOBTTY)) != job.mypgid)