-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
job_kill(): fix bogus assumption that login shell has PPID 1
Normally, suspending a login shell with SIGSTOP (e.g., kill -STOP $$) will irrecoverably freeze the terminal session, so it is a good idea to prohibit that. But job_kill() (called via the 'kill' built-in, b_kill()) assumes that any login shell has a parent PID of 1, a.k.a. init. This may have been valid on some systems back in the 1980s, but when people started using graphical terminals (if not before), that assumption became universally bogus. Some shells (at least yash) prohibit issuing SIGSTOP to self if their process is the session leader. But even that doesn't always hold. For instance, on macOS, the terminal creates a login(1) process (the session leader), and the login shell is its child. So really the only thing we can reliably do is check for the -l/--login/SH_LOGIN_SHELL shell option (as the 'suspend' built-in already does; see 3ba4900).
- Loading branch information
Showing
4 changed files
with
11 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters