From: Jakub Kicinski Date: Wed, 19 Feb 2025 23:49:50 +0000 (-0800) Subject: selftests: drv-net: add a warning for bkg + shell + terminate X-Git-Tag: v6.15-rc1~160^2~256^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=846742f7e32f;p=thirdparty%2Fkernel%2Flinux.git selftests: drv-net: add a warning for bkg + shell + terminate Joe Damato reports that some shells will fork before running the command when python does "sh -c $cmd", while bash on my machine does an exec of $cmd directly. This will have implications for our ability to terminate the child process on various configurations of bash and 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 Acked-by: Stanislav Fomichev Acked-by: Joe Damato Tested-by: Joe Damato Link: https://patch.msgid.link/20250219234956.520599-2-kuba@kernel.org Signed-off-by: Jakub Kicinski --- diff --git a/tools/testing/selftests/net/lib/py/utils.py b/tools/testing/selftests/net/lib/py/utils.py index 9e3bcddcf3e83..33b153767d896 100644 --- a/tools/testing/selftests/net/lib/py/utils.py +++ b/tools/testing/selftests/net/lib/py/utils.py @@ -61,6 +61,10 @@ class bkg(cmd): 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!") + def __enter__(self): return self