mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 10:41:31 +00:00
[ninjalog_uploader] Exclude absolute paths and options from targets
Absolute paths and options start with '-' should be excluded from targetrs. Bug: b/270907050 Change-Id: Ic430381084b6d3673c34b45c8b3ca967f0f8af89 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4302232 Reviewed-by: Takuto Ikuta <tikuta@chromium.org> Auto-Submit: Junji Watanabe <jwata@google.com> Commit-Queue: Junji Watanabe <jwata@google.com>
This commit is contained in:
@@ -86,15 +86,26 @@ def GetBuildTargetFromCommandLine(cmdline):
|
||||
targets = []
|
||||
|
||||
while idx < len(cmdline):
|
||||
if cmdline[idx] in onearg_flags:
|
||||
arg = cmdline[idx]
|
||||
if arg in onearg_flags:
|
||||
idx += 2
|
||||
continue
|
||||
|
||||
if (cmdline[idx][:2] in onearg_flags or cmdline[idx] in zeroarg_flags):
|
||||
if (arg[:2] in onearg_flags or arg in zeroarg_flags):
|
||||
idx += 1
|
||||
continue
|
||||
|
||||
targets.append(cmdline[idx])
|
||||
# A target doesn't start with '-'.
|
||||
if arg.startswith('-'):
|
||||
idx += 1
|
||||
continue
|
||||
|
||||
# Avoid uploading absolute paths accidentally. e.g. b/270907050
|
||||
if os.path.isabs(arg):
|
||||
idx += 1
|
||||
continue
|
||||
|
||||
targets.append(arg)
|
||||
idx += 1
|
||||
|
||||
return targets
|
||||
|
||||
Reference in New Issue
Block a user