diff --git a/NEWS b/NEWS index 4cd349e44..3c762a14f 100644 --- a/NEWS +++ b/NEWS @@ -3,12 +3,19 @@ For full details, see the git log at: https://github.com/ksh93/ksh/tree/1.0 Any uppercase BUG_* names are modernish shell bug IDs. -2022-08-23: +2022-02-23: - When reading input from the keyboard, ksh now turns off nonblocking I/O mode for standard input if a previously ran program left it on, so that interactive programs that expect it to be off work properly. +- Fixed a regression introduced on 2022-02-02 that caused interactive shells + to enter an infinite loop when a command failed to execute on Linux + systems with version 2.35 of glibc. + +- Fixed a SIGTTOU lockup that could cause ksh to freeze under strace(1) after + a command failed to execute in an interactive shell. + 2022-02-18: - Fixed a regression introduced on 2021-04-11 that caused the += operator in diff --git a/src/cmd/ksh93/sh/xec.c b/src/cmd/ksh93/sh/xec.c index 7d5c7c74d..0fbdaadeb 100644 --- a/src/cmd/ksh93/sh/xec.c +++ b/src/cmd/ksh93/sh/xec.c @@ -3598,19 +3598,35 @@ static pid_t sh_ntfork(const Shnode_t *t,char *argv[],int *jobid,int flag) fail: if(jobfork && spawnpid<0) job_fork(-2); - if(spawnpid == -1) switch(errno=sh.path_err) + if(spawnpid == -1) { - case ENOENT: - errormsg(SH_DICT,ERROR_exit(ERROR_NOENT),e_found+4); - UNREACHABLE(); +#if _use_ntfork_tcpgrp + if(jobwasset) + { + signal(SIGTTIN,SIG_IGN); + signal(SIGTTOU,SIG_IGN); + if(sh_isstate(SH_INTERACTIVE)) + signal(SIGTSTP,SIG_IGN); + else + signal(SIGTSTP,SIG_DFL); + } + if(job.jobcontrol) + tcsetpgrp(job.fd,sh.pid); +#endif /* _use_ntfork_tcpgrp */ + switch(errno=sh.path_err) + { + case ENOENT: + errormsg(SH_DICT,ERROR_exit(ERROR_NOENT),e_found+4); + UNREACHABLE(); #ifdef ENAMETOOLONG - case ENAMETOOLONG: - errormsg(SH_DICT,ERROR_exit(ERROR_NOENT),e_toolong+4); - UNREACHABLE(); + case ENAMETOOLONG: + errormsg(SH_DICT,ERROR_exit(ERROR_NOENT),e_toolong+4); + UNREACHABLE(); #endif - default: - errormsg(SH_DICT,ERROR_system(ERROR_NOEXEC),e_exec+4); - UNREACHABLE(); + default: + errormsg(SH_DICT,ERROR_system(ERROR_NOEXEC),e_exec+4); + UNREACHABLE(); + } } job_unlock(); }