mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Fix crash: do not list jobs if there is no job control
This bug caused an undefined state, which sometimes crashed the shell in job_list() or job_unpost(), if $PS1 contains a command substitution running an external command and the '-b'/'-o notify' shell option is active. So far the only known way to trigger the crash is by letting $TMOUT time out the interactive shell. See https://github.com/ksh93/ksh/issues/103 for details. src/cmd/ksh93/sh/jobs.c: job_reap(): - The check for the SH_NOTIFY option and the SH_TTYWAIT state before listing jobs was insufficient. Job control is disabled in command substitutions, so also check that job control is active before listing jobs. src/cmd/ksh93/sh.1: - Fix TMOUT documentation. The 'read' command in fact only times out when reading from a terminal, just like 'select'. Also document the extra 60 second grace period when an interactive shell prompt reads from a terminal. Fixes: https://github.com/ksh93/ksh/issues/103
This commit is contained in:
parent
49ae483574
commit
338586896d
4 changed files with 12 additions and 11 deletions
|
@ -460,7 +460,7 @@ int job_reap(register int sig)
|
|||
nochild = 1;
|
||||
}
|
||||
shp->gd->waitevent = waitevent;
|
||||
if(sh_isoption(SH_NOTIFY) && sh_isstate(SH_TTYWAIT))
|
||||
if(job.jobcontrol && sh_isoption(SH_NOTIFY) && sh_isstate(SH_TTYWAIT))
|
||||
{
|
||||
outfile = sfstderr;
|
||||
job_list(pw,JOB_NFLAG|JOB_NLFLAG);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue