Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix crash: do not list job if in 60 sec grace period (re: 3385868)
The crash in job_list() or job_unpost() could still occur after the previous patch if a signal was being handled after $TMOUT was exceeded and the 60-second grace period was entered. It *should* work to add a general check for !sh_isstate(SH_GRACE). We know that the SH_GRACE state is set immediately after printing the 60 second grace period warning message: https://github.com/ksh93/ksh/blob/9de65210/src/cmd/ksh93/sh/io.c#L1869-L1870 (and that the crashes occur upon re-evaluating the $PS1 prompt after setting the SH_GRACE state). We know that the SH_GRACE state is not turned off again until either the user enters a line: https://github.com/ksh93/ksh/blob/9de65210/src/cmd/ksh93/sh/main.c#L474 or the shell times out after the grace period: https://github.com/ksh93/ksh/blob/9de65210/src/cmd/ksh93/sh/io.c#L1861 The SH_GRACE state flag is not used or changed in any other context (verified with grep -rn SH_GRACE src/cmd/ksh93). So, logically, this should suffice to make sure the crash stays gone. src/cmd/ksh93/sh/jobs.c: job_reap(): - Do not list jobs when the SH_GRACE state (the 60 second timeout grace period after TMOUT was exceeded) is active. - Keep the previous check for job control just to be sure, and because it makes sense. Fixes: #103 (again)
- Loading branch information
e805c7d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fix causes
set -o notify
to break when a timeout is specified:e805c7d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reopening #103.