From b5bd9a5bfbc6601a965189f214518f21adfdcf46 Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Fri, 4 Aug 2023 09:17:28 -0400 Subject: [PATCH] stdin-killer: do not setpgrp if already leader Fixes failure like: 2023-08-03T19:40:10.942 INFO:teuthology.orchestra.run.smithi100.stderr:Traceback (most recent call last): 2023-08-03T19:40:10.942 INFO:teuthology.orchestra.run.smithi100.stderr: File "/usr/bin/stdin-killer", line 213, in 2023-08-03T19:40:10.943 INFO:teuthology.orchestra.run.smithi100.stderr: os.setpgrp() 2023-08-03T19:40:10.943 INFO:teuthology.orchestra.run.smithi100.stderr:PermissionError: [Errno 1] Operation not permitted Signed-off-by: Patrick Donnelly --- teuthology/task/install/bin/stdin-killer | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/teuthology/task/install/bin/stdin-killer b/teuthology/task/install/bin/stdin-killer index 8a78744a3..d5ff230b2 100755 --- a/teuthology/task/install/bin/stdin-killer +++ b/teuthology/task/install/bin/stdin-killer @@ -210,8 +210,10 @@ if __name__ == "__main__": } if NS.setpgrp == "self": - os.setpgrp() pgrp = os.getpgrp() + if pgrp != os.getpid(): + os.setpgrp() + pgrp = os.getpgrp() elif NS.setpgrp == "child": popen_kwargs["preexec_fn"] = os.setpgrp pgrp = None