From 077ec096bb6296e166f6cc043262b1623540c316 Mon Sep 17 00:00:00 2001 From: Chaminda Divitotawela Date: Fri, 25 Mar 2022 16:30:05 +1000 Subject: [PATCH] #996: Fix python_setup/install_tool.sh When the script executed on a runner which does not have python2, script incorrectly execute the code inside the if condition. This script runs using /bin/sh in Ubuntu and cause the problem. Fix for this issue to use different syntax in output redirection. Issue is reproduced using running the job on ubunutu container. Fix also verified in the action https://github.com/cdivitotawela/codeql-issue/actions/runs/2038007502 --- python-setup/install_tools.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-setup/install_tools.sh b/python-setup/install_tools.sh index 587ebc5259..ede9ac07d7 100755 --- a/python-setup/install_tools.sh +++ b/python-setup/install_tools.sh @@ -28,7 +28,7 @@ python3 -m pip install --user 'virtualenv<20.11' python3 -m pip install --user poetry!=1.0.10 python3 -m pip install --user pipenv -if command -v python2 &> /dev/null; then +if command -v python2 >/dev/null 2>&1; then # Setup Python 2 dependency installation tools. # The Ubuntu 20.04 GHA environment does not come with a Python 2 pip curl --location --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python2