From a0bd467cc774282a75c161696ca2956bc806cd46 Mon Sep 17 00:00:00 2001 From: Heng GAO Date: Mon, 6 Aug 2018 21:21:25 -0500 Subject: [PATCH] Fix a bug enviroment variable injection to a git repo url dependency. --- news/2635.bugfix | 1 + pipenv/patched/notpip/_internal/utils/misc.py | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 news/2635.bugfix diff --git a/news/2635.bugfix b/news/2635.bugfix new file mode 100644 index 0000000000..eaff5a701e --- /dev/null +++ b/news/2635.bugfix @@ -0,0 +1 @@ +Fix a enviroment injection issue when dealing with git repo url dependencies. The problem issued when pipenv trying to execute command similar to "git clone -q git+https://${USER}:${PASSWORD}/github.com" using python subprocess.Popen, the enviroment variable inside this command is not propely resolved.Which will cause a permission deny error or a repo not found error. diff --git a/pipenv/patched/notpip/_internal/utils/misc.py b/pipenv/patched/notpip/_internal/utils/misc.py index 459b309ad4..8cb994c18c 100644 --- a/pipenv/patched/notpip/_internal/utils/misc.py +++ b/pipenv/patched/notpip/_internal/utils/misc.py @@ -642,6 +642,8 @@ def call_subprocess(cmd, show_stdout=True, cwd=None, command_desc = ' '.join(cmd_parts) logger.debug("Running command %s", command_desc) env = os.environ.copy() + for idx in range(len(cmd)): + cmd[idx] = os.path.expandvars(cmd[idx]) if extra_environ: env.update(extra_environ) for name in unset_environ: