Skip to content

Commit 74be214

Browse files
scoptimgraham
authored andcommitted
Fixed #25221 -- Prevented django_bash_completion from leaking variables into the environment.
1 parent 6d7a9d9 commit 74be214

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

extras/django_bash_completion

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ complete -F _django_completion -o default django-admin.py manage.py django-admin
4242
_python_django_completion()
4343
{
4444
if [[ ${COMP_CWORD} -ge 2 ]]; then
45-
PYTHON_EXE=${COMP_WORDS[0]##*/}
45+
local PYTHON_EXE=${COMP_WORDS[0]##*/}
4646
echo $PYTHON_EXE | egrep "python([2-9]\.[0-9])?" >/dev/null 2>&1
4747
if [[ $? == 0 ]]; then
48-
PYTHON_SCRIPT=${COMP_WORDS[1]##*/}
48+
local PYTHON_SCRIPT=${COMP_WORDS[1]##*/}
4949
echo $PYTHON_SCRIPT | egrep "manage\.py|django-admin(\.py)?" >/dev/null 2>&1
5050
if [[ $? == 0 ]]; then
5151
COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]:1}" \
@@ -63,9 +63,11 @@ if command -v whereis &>/dev/null; then
6363
for python in $python_interpreters; do
6464
pythons="${pythons} ${python##*/}"
6565
done
66+
unset python_interpreters
6667
pythons=$(echo $pythons | tr " " "\n" | sort -u | tr "\n" " ")
6768
else
6869
pythons=python
6970
fi
7071

7172
complete -F _python_django_completion -o default $pythons
73+
unset pythons

0 commit comments

Comments
 (0)