Subject: Re: [PATCH net-next v2 1/7] selftests: drv-net: add a warning for bkg + shell + terminate

From: Joe Damato <[email-masked]>
Date: Thu, 20 Feb 2025 14:31:35 -0500

On Wed, Feb 19, 2025 at 03:49:50PM -0800, Jakub Kicinski wrote:
> Joe Damato reports that some shells will fork before running
> the command when python does "sh -c $cmd", while bash does
> an exec of $cmd directly. This will have implications for our
> ability to terminate the child process on bash vs other shells.
> Warn about using
> 
> 	bkg(... shell=True, termininate=True)
> 
> most background commands can hopefully exit cleanly (exit_wait).
> 
> Link: https://lore.kernel.org/Z7Yld21sv_Ip3gQx@LQ3V64L9R2
> Signed-off-by: Jakub Kicinski <[email-masked]>
> ---
> v2: new
> ---
>  tools/testing/selftests/net/lib/py/utils.py | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/tools/testing/selftests/net/lib/py/utils.py b/tools/testing/selftests/net/lib/py/utils.py
> index 9e3bcddcf3e8..33b153767d89 100644
> --- a/tools/testing/selftests/net/lib/py/utils.py
> +++ b/tools/testing/selftests/net/lib/py/utils.py
> @@ -61,6 +61,10 @@ import time
>          self.terminate = not exit_wait
>          self.check_fail = fail
>  
> +        if shell and self.terminate:
> +            print("# Warning: combining shell and terminate is risky!")
> +            print("#          SIGTERM may not reach the child on zsh/ksh!")
> +

This warning did not print on my system, FWIW. Up to you if you want
to respin and drop it or just leave it be.

I am fine with this warning being added, although I disagree with
the commit message as mentioned in my previous email.

Since the code seems fine though:

Acked-by: Joe Damato <[email-masked]>