fabioz / PyDev.Debugger

Sources for the debugger used in PyDev, PyCharm and VSCode Python
Eclipse Public License 1.0
434 stars 122 forks source link

Breakpoints not found when in a folder that contains ".zipx" #265

Open russau opened 1 year ago

russau commented 1 year ago

I can reproduce this in VSCode with ms-python.python extension installed

If I create a file .zipx/main.py I see errors in the debugger log

    "body": {
        "breakpoints": [
            {
                "verified": false,
                "id": 1,
                "message": "Breakpoint in file that does not exist.",
                "source": {
                    "name": "main.py",
                    "path": "/Users/russau/verytemp/python-test/.zipx/main.py"
                },
                "line": 1
            }
        ]
    }

I've traced it to this line of code detecting the ".zip" in the folder name

https://github.com/fabioz/PyDev.Debugger/blob/47300e090388fa74e0650bf8af93ea19ca8074ea/pydevd_file_utils.py#L489-L503

_apply_func_and_normalize_case turns the path /Users/russau/verytemp/python-test/.zipx/main.py into /Users/russau/verytemp/python-test/.zip/x/main.py. I'm not familiar with the code, I guess it supports a "code in a zip file" feature. Maybe the fix is to test if the filename exists before entering into the "inside a zip file" logic?

Thanks all!