Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not killing unrelated processes #18

Open
magicant opened this issue Sep 10, 2023 · 1 comment
Open

Not killing unrelated processes #18

magicant opened this issue Sep 10, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@magicant
Copy link
Owner

(Issue migrated from https://osdn.net/projects/yash/ticket/47669)

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.

@magicant magicant added the enhancement New feature or request label Sep 10, 2023
@magicant
Copy link
Owner Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant