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

Support dealing with paths with inconsistent casing on Mac OS #1031

Closed
sthz31 opened this issue Aug 25, 2022 · 10 comments
Closed

Support dealing with paths with inconsistent casing on Mac OS #1031

sthz31 opened this issue Aug 25, 2022 · 10 comments
Labels
bug Something isn't working waiting for response

Comments

@sthz31
Copy link

sthz31 commented Aug 25, 2022

Type: Bug

VS Code Version: 1.70.2 (Universal)
OS Version: MacOS (M1)
Python Extension Version: v2022.12.1
Pylance Extension Version: v2022.8.40
Python Version: 3.10

Steps to Reproduce:

Open the django project.
Create lunch.json file for django
Run the debugger.
Keep breakpoins
Does't stop in Breakpoint.

Extension version: 2022.12.1
VS Code version: Code 1.70.2 (Universal) (e4503b30fc78200f846c62cf8091b76ff5547662, 2022-08-16T05:36:37.829Z)
OS version: Darwin arm64 21.6.0
Modes:

System Info
Item Value
CPUs Apple M1 Pro (8 x 24)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 3, 3, 3
Memory (System) 16.00GB (0.23GB free)
Process Argv . --crash-reporter-id db94bd0c-012b-4b52-a4b8-60239d632f42
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256859
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonvspyt551:30345470
pythonptprofiler:30281270
vsdfh931cf:30280410
vshan820:30294714
vstes263:30335439
vscoreces:30445986
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30542924
vsaa593:30376534
pythonvs932:30410667
wslgetstarted:30449410
cppdebug:30492333
pylanb8912:30545647
vsclangdf:30486550
c4g48928:30535728
hb751961:30553087
dsvsc012:30540252
azure-dev_surveyone:30548225
i497e931:30553904

@karthiknadig karthiknadig transferred this issue from microsoft/vscode-python Aug 25, 2022
@fabioz
Copy link
Collaborator

fabioz commented Aug 26, 2022

@sthz31 can you provide the logs for this?

See: https://github.com/microsoft/debugpy/wiki/Enable-debugger-logs for details on how to collect the logs.

@sthz31
Copy link
Author

sthz31 commented Aug 27, 2022

@fabioz
Copy link
Collaborator

fabioz commented Aug 27, 2022

@sthz31 there should be multiple generated files log files (usually 3, the most important for this case is the one related to pydevd).

You should be able to just drag and drop those while you're creating a comment in GitHub to attach them to this issue. Can you do that?

@int19h
Copy link
Contributor

int19h commented Sep 27, 2022

The pydevd log above corresponds to the parent process of your app - the one that watches the filesystem and restarts the child process that actually runs your code. There should be another file named debugpy.pydevd*.log, corresponding to that child process.

Also, can you share your debug configuration, and the startup file that sets up the Django app? I wonder if there's some settrace-related facility there that just overrides the debugger, like there is with Flask.

@int19h int19h added bug Something isn't working waiting for response labels Sep 27, 2022
@jjulian91
Copy link

jjulian91 commented Oct 18, 2022

update -> We reinstalled the python extension in VS code and issue has been cleared (along with all other trouble shooting steps below)

Seeing the same issues here with our project.

Notes that we have figured out:
Certain files work because they are correctly being resolved, other files can only have break point using breakpoint(). These particular files are not being resolved to the same file path, although they are in the same folder.
Changing the file name from Camel_SnakeCase to snake_case resolves issue, but this should not be a requirement.

image

Below are the only 2 log files for pydevd shown up following the above wiki.

debugpy.pydevd.15458.log

debugpy.pydevd.15637.log

Launch.Json for this machine:
image

Mac information:
image

@fabioz
Copy link
Collaborator

fabioz commented Oct 20, 2022

I was checking the logs and the difference seems to be in how VSCode is sending the breakpoints to the debugger.

In the case where it doesn't work it seems to be passing breakpoints with a case such as:

/users/new/desktop
/users/chefables_imac/desktop

But the debugger/Python sees the paths as:

/Users/new/Desktop

I'm not sure why VSCode is passing lowercase paths to the debugger (it should usually pass the paths with the proper case, so, this does seem like an issue on VSCode itself).

We do deal with case-insensitivity on Windows (where it's very common for the drive letter to have a different case) but not for Mac/Linux, so, the fix here would be making the debugger work the same way with MacOS (the debugger needs to normalize internally to lowercase but when passing to the client convert it to the real case).

One workaround to check would be checking if when you open the folder in VSCode you're opening it with the proper casing (maybe that could play a part there).

Apparently Mac OS can be configured to be case-insensitive (default) or case-sensitive, so, the debugger should have a way to support it on Mac in the same way that it supports it on Windows.

@fabioz fabioz changed the title doesn't stop at breakpoints Support dealing with paths with inconsistent casing on Mac OS Oct 20, 2022
@jjulian91
Copy link

I was checking the logs and the difference seems to be in how VSCode is sending the breakpoints to the debugger.

In the case where it doesn't work it seems to be passing breakpoints with a case such as:

/users/new/desktop /users/chefables_imac/desktop

But the debugger/Python sees the paths as:

/Users/new/Desktop

I'm not sure why VSCode is passing lowercase paths to the debugger (it should usually pass the paths with the proper case, so, this does seem like an issue on VSCode itself).

We do deal with case-insensitivity on Windows (where it's very common for the drive letter to have a different case) but not for Mac/Linux, so, the fix here would be making the debugger work the same way with MacOS (the debugger needs to normalize internally to lowercase but when passing to the client convert it to the real case).

One workaround to check would be checking if when you open the folder in VSCode you're opening it with the proper casing (maybe that could play a part there).

Apparently Mac OS can be configured to be case-insensitive (default) or case-sensitive, so, the debugger should have a way to support it on Mac in the same way that it supports it on Windows.

Thanks for the follow up --

In this particular case it may not be directly associated with VS code as the solution we figured out was buttoned up by uninstalling and reinstalling the python extension in VS code.

@fabioz
Copy link
Collaborator

fabioz commented Oct 20, 2022

Thanks for the follow up --

In this particular case it may not be directly associated with VS code as the solution we figured out was buttoned up by uninstalling and reinstalling the python extension in VS code.

Well, it's VSCode that passes the files to the debugger (not vscode-python), so, the issue could've been indirectly fixed just by restarting VSCode (perhaps it got into a weird situation) or just opening the folder again with the proper casing... (this is actually the 2nd report regarding that -- the other #679 also was magically fixed... I believe it has something to do with how VSCode is seeing the folder, but given that Mac OS is case independent the debugger should work properly even in that case).

@jjulian91
Copy link

jjulian91 commented Oct 20, 2022

Thanks for the follow up --
In this particular case it may not be directly associated with VS code as the solution we figured out was buttoned up by uninstalling and reinstalling the python extension in VS code.

Well, it's VSCode that passes the files to the debugger (not vscode-python), so, the issue could've been indirectly fixed just by restarting VSCode (perhaps it got into a weird situation) or just opening the folder again with the proper casing... (this is actually the 2nd report regarding that -- the other #679 also was magically fixed... I believe it has something to do with how VSCode is seeing the folder, but given that Mac OS is case independent the debugger should work properly even in that case).

Got it -- We did do multiple computer restarts and multiple VS code restarts (killing the proccess and all) -- Not sure if there is any caching in the exchange of VS->python that was erased when the extension was uninstalled. I will continue to follow to offer any assistance in our example as needed.

File structure wise -- we were able to debug other files in the same path
IE: /users/chefables_imac/desktop/Application/Project/Folder/SubFolder/File1
/users/chefables_imac/desktop/Application/Project/Folder/SubFolder/File2

File1 failed debug file 2 was fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working waiting for response
Projects
None yet
Development

No branches or pull requests

5 participants