Ticket #47669

Not killing unrelated processes

Open Date: 2023-03-24 02:08 Last Update: 2023-03-24 20:04

Reporter:
Owner:
Status:
Open [Owner assigned]
Component:
MileStone:
(None)
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
None
File:
None
Vote
Score: 0
No votes
0.0% (0/0)
0.0% (0/0)

Details

cf. https://www.austingroupbugs.net/view.php?id=1585

It might possibly be useful to add an option that makes the kill built-in send a signal only to the shell's direct child processes. It ensures the signal is not sent to an unrelated process that has reused the process ID of a child process of the shell.

Note that it only works for direct children of the shell. The shell cannot detect grandchildren.

Multi-process pipelines will not benefit from this feature as the signal can be sent only to the last component of the pipeline when you pass the expansion of $! to the kill built-in.

Also, this would not be very useful for job-controlled jobs as they can safely be killed by the job ID notation.

Ticket History (2/2 Histories)

2023-03-24 02:08 Updated by: magicant
  • New Ticket "Not killing unrelated processes" created
2023-03-24 20:04 Updated by: magicant
Comment

Also, this would not be very useful for job-controlled jobs as they can safely be killed by the job ID notation.

Actually, the current shell implementation does not kill jobs safely. Yash sends a signal to the job process group regardless of whether the job processes are still running.

However, the shell cannot be fully correct because of possible descendant processes in the process group. Even if the process group leader has ended, there may be (orphan) processes in the process group which should be signaled. The shell cannot tell whether the process is part of the process group it created or an unrelated process group created by another shell.

Attachment File List

No attachments

Edit

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login