coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

timeout: fails to kill child process when given as sh -c

Open jfinkels opened this issue 3 years ago • 0 comments
trafficstars

Environment: Ubuntu 20.04.4, coreutils v8.30, sh links to dash

The uutils version of timeout fails to kill the child process when it is given as sh -c "...".

GNU timeout:

$ timeout 1 sh -c "yes > /dev/null"
$ ps | grep [y]es
# no output, meaning no running process, as expected

uutils timeout:

$ ./target/release/timeout 1 sh -c "yes > /dev/null"
$ ps | grep [y]es
2458257 pts/1    00:00:02 yes

However, uutils timeout does correctly kill the child process when it is given directly:

$ ./target/release/timeout 1 yes > /dev/null
$ ps | grep [y]es
# no output, meaning no running process, as expected

This causes an orphan process in the GNU test case tests/split/filter.sh.

jfinkels avatar May 06 '22 01:05 jfinkels