Commit c4b1b772 authored by Bruce Dawson's avatar Bruce Dawson Committed by LUCI CQ

Prevent path-pollution from vpython3.bat

vpython3.bat adds an entry to the path. Unfortunately that modification
persists after the batch file returns. Repeated running of vpython3.bat
will eventually grow the path so long that the command to update the
path exceeds the 8191 character cmd.exe command-length limit. This can
most easily be seen by repeatedly running this command:

    vpython3 -c "print('Hello world!')" && set path | wc

After about 35 invocations (dependent on exact system setup) this
happens:

    >vpython3 -c "print('Hello world!')" && set path | wc
    The input line is too long.
    The syntax of the command is incorrect.

This batch also (but less critically) leaks the PYTHON3_BIN_RELDIR
environment variable.

The fix is to add a setlocal command to keep environment changes local.

Bug: 1003139
Change-Id: I11a31e1013017da702299bfe8eb4888985c228f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3566378Reviewed-by: 's avatarAravind Vasudevan <aravindvasudev@google.com>
Reviewed-by: 's avatarJosip Sokcevic <sokcevic@google.com>
Reviewed-by: 's avatarBrian Ryner <bryner@google.com>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
parent a9c548ef
......@@ -5,6 +5,7 @@
:: TODO(crbug.com/1003139): Remove.
:: Add Python 3 to PATH to work around crbug.com/1003139.
setlocal
for /f %%i in (%~dp0python3_bin_reldir.txt) do set PYTHON3_BIN_RELDIR=%%i
set PATH=%~dp0%PYTHON3_BIN_RELDIR%;%~dp0%PYTHON3_BIN_RELDIR%\Scripts;%~dp0%PYTHON3_BIN_RELDIR%\DLLs;%PATH%
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment