-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix double-escaped paths on Windows #9814
Conversation
@@ -808,8 +808,8 @@ def assertNotExists(self, filename, msg=None): | |||
|
|||
# Tests that the given two paths are identical, modulo path delimiters. E.g. "C:/foo" is equal to "C:\foo". | |||
def assertPathsIdentical(self, path1, path2): | |||
path1 = path1.replace('\\', '/').replace('//', '/') | |||
path2 = path2.replace('\\', '/').replace('//', '/') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not totally sure about this.. but if not tests fail then I guess its fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I said in the description, this is what was hiding the problem in the first place - assertPathsIdentical
shouldn't fix double-slashes itself, as real consumers also wouldn't.
On Windows, paths are using \, which is escaped to \\ by llvm-dwarfdump in its output. We need to unescape them before passing to source map encoder, as otherwise we end up with invalid paths and URLs that can't be resolved. This wasn't caught before, because assertPathsIdentical was performing its own unescaping before comparing paths, which is not what happens in real source map consumers. Fixes emscripten-core#9811.
8f3cb8e
to
aa78e1e
Compare
lgtm too, thanks @RReverser! Is this ready to merge, or was there something more to look into here? |
Yes, this is ready to merge - the other issue is completely separate. |
Thanks, merging! I'd like to look at the other issue that you noticed, but I don't remember what it was, was that filed? |
On Windows, paths are using \, which is escaped to \\ by llvm-dwarfdump in its output. We need to unescape them before passing to source map encoder, as otherwise we end up with invalid paths and URLs that can't be resolved. This wasn't caught before, because assertPathsIdentical was performing its own unescaping before comparing paths, which is not what happens in real source map consumers. Fixes emscripten-core#9811.
On Windows, paths are using
\
, which is escaped to\\
by llvm-dwarfdump in its output.We need to unescape them before passing to source map encoder, as otherwise we end up with invalid paths and URLs that can't be resolved.
This wasn't caught before, because
assertPathsIdentical
was performing its own unescaping before comparing paths, which is not what happens in real source map consumers.Fixes #9811.