Commit 727b49dd authored by Ken Rockot's avatar Ken Rockot Committed by Commit Bot

Normalize input mojom paths for presubmit check

The presubmit input API provides local path names in the OS's native
format. The mojom compatibility checking script effectively assumes
POSIX format. This leads to various wonderful forms of failure whenever
paths are used to represent module identity in scripts.

In this case, mismatches between changed input file paths and mojom
import paths can result in the stability checking tool using the newer
(i.e. post-change) version of an input file when processing the older
(pre-change) contents of other files. This can obviously lead to very
surprising behavior like missing type information.

In the limit we should be using pathlib to manipulate paths consistently
across platforms. For now, this change settles on rewriting the tool's
input paths to be in POSIX form consistently.

Fixed: 1096841
Change-Id: I4beff9a49d573df3815160e2320097886d94d692
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2254709
Auto-Submit: Ken Rockot <rockot@google.com>
Reviewed-by: default avatarOksana Zhuravlova <oksamyt@chromium.org>
Commit-Queue: Ken Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/master@{#780406}
parent b52da9c1
...@@ -46,7 +46,8 @@ def _ValidateDelta(root, delta): ...@@ -46,7 +46,8 @@ def _ValidateDelta(root, delta):
old_files = {} old_files = {}
new_files = {} new_files = {}
for change in delta: for change in delta:
filename = change['filename'] # TODO(crbug.com/953884): Use pathlib once we're migrated fully to Python 3.
filename = change['filename'].replace('\\', '/')
affected_files.add(filename) affected_files.add(filename)
if change['old']: if change['old']:
old_files[filename] = change['old'] old_files[filename] = change['old']
......
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