From c76490d157e0f23ee12909e0a907c9d090b5a97c Mon Sep 17 00:00:00 2001 From: Benjamin Poldrack Date: Wed, 14 Oct 2020 10:13:58 +0200 Subject: [PATCH 1/2] BF: Don't modify PATH if not necessary PATH modification in Runner classes is meant to make sure we use bundled w/ annex git executable (except when instructed otherwise by DATALAD_USE_DEFAULT_GIT). However, don't mess with PATH when what we find to be bundled is the same thing that is found with unmodified PATH anyway. This is particularly important when the 'bundeled' location is /usr/bin and we are running in a virtual environment, leading to that PATH overruling the venv. (Closes #5030) --- datalad/cmd.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/datalad/cmd.py b/datalad/cmd.py index 16ab8b79a5..89f84d3147 100644 --- a/datalad/cmd.py +++ b/datalad/cmd.py @@ -1091,7 +1091,12 @@ def _get_bundled_path(): alongside = False else: annex_path = op.dirname(op.realpath(annex_fpath)) - alongside = op.lexists(op.join(annex_path, 'git')) + bundled_git_path = op.join(annex_path, 'git') + # we only need to consider bundled git if it's actually different + # from default. (see issue #5030) + alongside = op.lexists(bundled_git_path) and \ + bundled_git_path != find_executable('git') + return annex_path if alongside else '' @staticmethod From 908d3e813e89f36c7cd9d06aa6bdf7fbe92d4027 Mon Sep 17 00:00:00 2001 From: Benjamin Poldrack Date: Wed, 14 Oct 2020 16:33:20 +0200 Subject: [PATCH 2/2] BF: Compare realpath to realpath --- datalad/cmd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datalad/cmd.py b/datalad/cmd.py index 89f84d3147..d861bcd8ce 100644 --- a/datalad/cmd.py +++ b/datalad/cmd.py @@ -1095,7 +1095,7 @@ def _get_bundled_path(): # we only need to consider bundled git if it's actually different # from default. (see issue #5030) alongside = op.lexists(bundled_git_path) and \ - bundled_git_path != find_executable('git') + bundled_git_path != op.realpath(find_executable('git')) return annex_path if alongside else ''