From d549bd3aa3e2eb5e3e8ba984c1e293f97409253e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milo=C5=A1=20Prchl=C3=ADk?= Date: Sat, 3 Aug 2024 09:21:05 +0200 Subject: [PATCH] User per-guest SSH master sockets to prevent re-use (#3127) It seems that under some conditions, using same socket path for SSH master processes may lead to SSH commands to operate over incorrect and unexpected guest without noticing. Using per-guest paths should prevent such a race condition. The problem was revealed by `/tests/prepare/multihost` test constantly and reliably failing in Github CI, as all `prepare` phases were connecting to the very same guest. --- tmt/steps/provision/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmt/steps/provision/__init__.py b/tmt/steps/provision/__init__.py index fb5defbab2..7443daf599 100644 --- a/tmt/steps/provision/__init__.py +++ b/tmt/steps/provision/__init__.py @@ -1392,7 +1392,7 @@ def _ssh_master_socket_path(self) -> Path: # Use '/run/user/uid' if it exists, 'temp dir' otherwise. run_dir = Path(f"/run/user/{os.getuid()}") socket_dir = run_dir if run_dir.is_dir() else Path(tempfile.mkdtemp()) - return socket_dir / "tmt" + return socket_dir / f'tmt-{self.pathless_safe_name}' @property def _ssh_options(self) -> Command: