Commit 4ef3221c authored by Henrique Ferreiro's avatar Henrique Ferreiro Committed by Commit Bot

Bail out only if depot_tools path contains a tilde

Previously, gclient will exit if it found a tilde in any element from
PATH. This CL changes that to first check if the path is the actual
depot_tools directory.

Also check for '~', instead of '~/', in case the path looks like
'~user/path/to/depot_tools/.

Bug: 952865
Change-Id: Ied07444e44edb655b5c8837b5e51eeb0dcebba6d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1581419Reviewed-by: 's avatarAaron Gable <agable@chromium.org>
Commit-Queue: Henrique Ferreiro <hferreiro@igalia.com>
parent 623238e1
......@@ -125,6 +125,8 @@ except NameError:
basestring = str
DEPOT_TOOLS_DIR = os.path.dirname(os.path.abspath(os.path.realpath(__file__)))
# Singleton object to represent an unset cache_dir (as opposed to a disabled
# one, e.g. if a spec explicitly says `cache_dir = None`.)
UNSET_CACHE_DIR = object()
......@@ -3100,7 +3102,8 @@ def disable_buffering():
def path_contains_tilde():
for element in os.environ['PATH'].split(os.pathsep):
if element.startswith('~/'):
if element.startswith('~') and os.path.abspath(
os.path.realpath(os.path.expanduser(element))) == DEPOT_TOOLS_DIR:
return True
return False
......
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