mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
Error out in gclient config if --name is relative
This helps prevent behavior such as setting '--name .' so that the .gclient file contains '.' as the name of the solution, and the .gclient file ends up a sibling of the .git file, rather than a sibling of the git checkout's containing directory. R=iannucci@chromium.org, thestig@chromium.org Review URL: https://codereview.chromium.org/1406053003 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@297343 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
@@ -1886,6 +1886,12 @@ def CMDconfig(parser, args):
|
||||
else:
|
||||
# specify an alternate relpath for the given URL.
|
||||
name = options.name
|
||||
if not os.path.abspath(os.path.join(os.getcwd(), name)).startswith(
|
||||
os.getcwd()):
|
||||
parser.error('Do not pass a relative path for --name.')
|
||||
if any(x in ('..', '.', '/', '\\') for x in name.split(os.sep)):
|
||||
parser.error('Do not include relative path components in --name.')
|
||||
|
||||
deps_file = options.deps_file
|
||||
safesync_url = ''
|
||||
if len(args) > 1:
|
||||
|
||||
Reference in New Issue
Block a user