Bug 12176 - kill signal not delivered until subshell exits
Summary: kill signal not delivered until subshell exits
Status: NEW
Alias: None
Product: Busybox
Classification: Unclassified
Component: Standard Compliance (show other bugs)
Version: 1.28.x
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-03 11:55 UTC by Mavik
Modified: 2019-09-03 11:56 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mavik 2019-09-03 11:55:58 UTC
I've found that a signal from kill is not delivered from a subshell until the subshell completes:

eg.

FUNCTION()
{
    kill $1
    sleep 1
    ps | grep $1
}

When called as follows, as expected the backgrounded process is killed by FUNCTION():

# while true; do sleep 1; done &
# echo $!
26276
# FUNCTION 26276
26624 root      4164 S    grep 26276
[1]+  Terminated                 while true; do sleep 1; done
#

But when called in a subshell, the background process doesn't appear to be killed until the subshell returns:

# while true; do sleep 1; done &
# echo $!
29632
# ret=$(FUNCTION 29632) 
[1]+  Terminated                 while true; do sleep 1; done
# echo "$ret"
29632 root         0 Z    [sh]
31456 root      4164 S    grep 29632

Is that expected behaviour?