Skip to content
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

DAP sources are case sensitive on insensitive filesystems #106382

Closed
connor4312 opened this issue Sep 10, 2020 · 13 comments
Closed

DAP sources are case sensitive on insensitive filesystems #106382

connor4312 opened this issue Sep 10, 2020 · 13 comments
Assignees
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality insiders-released Patch has been released in VS Code Insiders on-release-notes Issue/pull request mentioned in release notes verification-needed Verification of issue is requested verified Verification succeeded

Comments

@connor4312
Copy link
Member

connor4312 commented Sep 10, 2020

From #102493 (comment)

In this case:

  1. The user had Node.js importing a different casing of their file (socks5udp) than what was actually on their disk (socks5UDP).
{
  "source": {
    "name": "socks5UDP.js",
    "path": "c:\\Users\\Rohit Kapoor\\source\\sockem\\lib\\socks5UDP.js"
  },
  1. They set breakpoints, VS Code set in socks5UDP
  2. We set the breakpoint, and V8 resolved it. V8 used the imported casing socks5udp
  3. Then js-debug sent back that the breakpoint in the source, using the casing/path from Chrome
{
  "name": "lib/socks5udp.js",
  "path": "c:\\Users\\Rohit Kapoor\\source\\sockem\\lib\\socks5udp.js",
  "sourceReference": 0
}
  1. This caused the breakpoint to move out of its correct file in VS Code

What should be the proper behavior here? Who should canonicalize the path?

@connor4312 connor4312 added the under-discussion Issue is under discussion for relevance, priority, approach label Sep 10, 2020
@weinand weinand added the debug Debug viewlet, configurations, breakpoints, adapter issues label Sep 10, 2020
@weinand
Copy link
Contributor

weinand commented Sep 10, 2020

Yes, the fact that node.js allows to import a different casing of a file (and the fact that drive letter casing on Windows is not predictable either) is a nightmare.

[In the legacy node-debugger I was registering breakpoints with a regexp instead of path for that reason (to make the breakpoint matching case insensitive). But it seems that breakpoint matching is not your problem here...]

We came to the conclusion that ideally VS Code should handle cases like this in a smart way: mapping file paths that differ only in casing back to a single file in the workspace (instead of opening another editor...).

However, at that time for some reason (@isidorn?) it was not easy/possible to implement that strategy with the workspace API. So we added workarounds in the debug adapters to return paths that would "match" VS Code's expectations.

But today workspace has better support for smart matching files with case differences. I think we should finally tackle the problem on the VS Code side so that debug adapters don't have to deal with this anymore.

@isidorn what is your take?

@bpasero
Copy link
Member

bpasero commented Sep 10, 2020

Fyi @jrieken and me tackled casing issues in the workbench with the use of IUriIdentityService and specifically asCanonicalUri in dedicated places e.g. where we open an editor or where we receive markers that we need to correlate back to an opened editor.

@isidorn
Copy link
Contributor

isidorn commented Sep 10, 2020

I think it makes sense that we tackle this on the VS Code. More specificily:

  • Whenever VS Code ui recieves a Source object we would always use the asCanonicalUri internally.
  • Open question is what should VS Code send out to the Debug Extension when sending back that Source object. Probably the same form that VS Code recieved from the debug extension

Let me know what you think

@connor4312
Copy link
Member Author

Open question is what should VS Code send out to the Debug Extension when sending back that Source object. Probably the same form that VS Code recieved from the debug extension

At least for js-debug, I always normalize path casing on windows, so it doesn't matter.

@isidorn
Copy link
Contributor

isidorn commented Sep 11, 2020

Ok, since there are no complaints let's do what I suggested above.
Thus assigning to me and September.

@isidorn isidorn added this to the September 2020 milestone Sep 11, 2020
@isidorn isidorn added debt Code quality issues and removed under-discussion Issue is under discussion for relevance, priority, approach labels Sep 11, 2020
@weinand
Copy link
Contributor

weinand commented Sep 11, 2020

@isidorn Yes, VS Code should leave data received from the DA unmodified when sending it back to the DA.

@isidorn
Copy link
Contributor

isidorn commented Sep 16, 2020

I have pushed a change as we have agreed Whenever VS Code ui recieves a Source object we would always use the asCanonicalUri internally. And VS Code leaves data from the DA unmodified.

However I did not have a chance to try this out since I do not have exact repro steps.
@connor4312 can you please try it out with VS Code insiders from tomorrow or can you share exact repro steps so I try this on my machine?

@isidorn
Copy link
Contributor

isidorn commented Sep 17, 2020

Insiders build with this change is out. Let me know how it behaves. Thanks!

@connor4312
Copy link
Member Author

I was able to repro this in today's insiders. Here's what I'm doing: https://memes.peet.io/img/20-09-8e9d658e-4062-4eca-9e66-068c3ae4c21a.mp4

@isidorn
Copy link
Contributor

isidorn commented Sep 18, 2020

@connor4312 thanks a lot for that example. I was able to repro. Required a bit more changes from my side, but now it behaves good for me.
So closing this.
If you see more issues please let me know, though now I am confident about the change.

@isidorn
Copy link
Contributor

isidorn commented Sep 22, 2020

Let's add a verification needed here. So @connor4312 can add verified when this seems to work all right for him.

@isidorn isidorn added feature-request Request for new features or functionality verification-needed Verification of issue is requested and removed debt Code quality issues labels Sep 22, 2020
@connor4312
Copy link
Member Author

Looks good in my testing 👍

@connor4312 connor4312 added the verified Verification succeeded label Sep 22, 2020
@isidorn
Copy link
Contributor

isidorn commented Sep 23, 2020

Thanks a lot for testing it out!

@isidorn isidorn added the on-release-notes Issue/pull request mentioned in release notes label Sep 24, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Nov 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality insiders-released Patch has been released in VS Code Insiders on-release-notes Issue/pull request mentioned in release notes verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

5 participants
@bpasero @weinand @isidorn @connor4312 and others