vpython: clear DEPOT_TOOLS_DIR before running scripts

Once we're done using DEPOT_TOOLS_DIR to bootstrap ourselves, remove
it from the env so it isn't passed to the python script which might
in turn run commands from other depot_tools trees.  Like gclient and
running chromium/src/third_party/depot_tools/ programs.

Bug: 1470590
Change-Id: I3dee847e45896ee25f01054026805277fc373c37
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4764126
Auto-Submit: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
changes/26/4764126/2
Mike Frysinger 2 years ago committed by LUCI CQ
parent 69611efc03
commit f90cc29837

@ -42,11 +42,15 @@ export DEPOT_TOOLS_UNAME_S="${DEPOT_TOOLS_UNAME_S:-$(uname -s | tr '[:upper:]' '
source "${DEPOT_TOOLS_DIR}/cipd_bin_setup.sh" source "${DEPOT_TOOLS_DIR}/cipd_bin_setup.sh"
cipd_bin_setup &> /dev/null cipd_bin_setup &> /dev/null
# Don't pass this to the Python script as it might turn around and run commands
# in other depot_tools dirs.
base_dir="${DEPOT_TOOLS_DIR}"
unset DEPOT_TOOLS_DIR
case "${DEPOT_TOOLS_UNAME_S}" in case "${DEPOT_TOOLS_UNAME_S}" in
mingw*|cygwin*) mingw*|cygwin*)
cmd.exe //c $0.bat "$@" cmd.exe //c $0.bat "$@"
;; ;;
*) *)
exec "${DEPOT_TOOLS_DIR}/.cipd_bin/vpython" "$@" exec "${base_dir}/.cipd_bin/vpython" "$@"
;; ;;
esac esac

@ -40,11 +40,15 @@ export DEPOT_TOOLS_UNAME_S="${DEPOT_TOOLS_UNAME_S:-$(uname -s | tr '[:upper:]' '
source "${DEPOT_TOOLS_DIR}/cipd_bin_setup.sh" source "${DEPOT_TOOLS_DIR}/cipd_bin_setup.sh"
cipd_bin_setup &> /dev/null cipd_bin_setup &> /dev/null
# Don't pass this to the Python script as it might turn around and run commands
# in other depot_tools dirs.
base_dir="${DEPOT_TOOLS_DIR}"
unset DEPOT_TOOLS_DIR
case "${DEPOT_TOOLS_UNAME_S}" in case "${DEPOT_TOOLS_UNAME_S}" in
mingw*|cygwin*) mingw*|cygwin*)
cmd.exe //c $0.bat "$@" cmd.exe //c $0.bat "$@"
;; ;;
*) *)
exec "${DEPOT_TOOLS_DIR}/.cipd_bin/vpython3" "$@" exec "${base_dir}/.cipd_bin/vpython3" "$@"
;; ;;
esac esac

Loading…
Cancel
Save