From cd9ed10a155041146c9414784a149d7eba4d9257 Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Thu, 8 Mar 2018 14:51:39 +0100 Subject: [PATCH 1/2] Fix 'git_repo_exist' bug causing a deadlock * Use command option `-h` with `git ls-remote` to list only refs/heads reducing the size of the output. --- reframe/utility/os.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/reframe/utility/os.py b/reframe/utility/os.py index 53f9de1f67..56743059ef 100644 --- a/reframe/utility/os.py +++ b/reframe/utility/os.py @@ -227,7 +227,8 @@ def git_repo_exists(url, timeout=5): """Check if URL refers to git valid repository.""" try: os.environ['GIT_TERMINAL_PROMPT'] = '0' - run_command('git ls-remote %s' % url, check=True, timeout=timeout) + run_command('git ls-remote --exit-code -h %s' % url, check=True, + timeout=timeout) except (SpawnedProcessTimeout, SpawnedProcessError): return False else: From 96b7302ef815080f65b5a017c27215fc2d875439 Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Thu, 8 Mar 2018 15:08:22 +0100 Subject: [PATCH 2/2] Remove 'exit-code' command option * Remove `--exit-code` option which is not available is older versions of `git ls-remote`. --- reframe/utility/os.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reframe/utility/os.py b/reframe/utility/os.py index 56743059ef..69f2dc2ca6 100644 --- a/reframe/utility/os.py +++ b/reframe/utility/os.py @@ -227,7 +227,7 @@ def git_repo_exists(url, timeout=5): """Check if URL refers to git valid repository.""" try: os.environ['GIT_TERMINAL_PROMPT'] = '0' - run_command('git ls-remote --exit-code -h %s' % url, check=True, + run_command('git ls-remote -h %s' % url, check=True, timeout=timeout) except (SpawnedProcessTimeout, SpawnedProcessError): return False