From 9b9260a43074dc0f7c51e87fc874369b09826969 Mon Sep 17 00:00:00 2001 From: Giovanni Pizzi Date: Tue, 7 Dec 2021 13:28:59 +0100 Subject: [PATCH] Fix listdir method with pattern for SSH The `listdir` method of the SSH transport plugin was using `glob.glob` instead of `self.glob` when a pattern was specified. This is wrong because it's listing files locally and not on the remote. The tests passed because they are running on localhost. Also, this method is probably never called by AiiDA so it went unnoticed. This commit fixes the issue. I'm not sure if there is a simple way to fix the tests - probably we should run them against a docker container or at least a chroot'ed folder? This might be another issue to be opened though. Fixes #5244 --- aiida/transports/plugins/ssh.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aiida/transports/plugins/ssh.py b/aiida/transports/plugins/ssh.py index 61ba5dda30..f47c9ef198 100644 --- a/aiida/transports/plugins/ssh.py +++ b/aiida/transports/plugins/ssh.py @@ -1274,7 +1274,7 @@ def listdir(self, path='.', pattern=None): else: base_dir = os.path.join(self.getcwd(), path) - filtered_list = glob.glob(os.path.join(base_dir, pattern)) + filtered_list = self.glob(os.path.join(base_dir, pattern)) if not base_dir.endswith('/'): base_dir += '/' return [re.sub(base_dir, '', i) for i in filtered_list]