Skip to content
This repository was archived by the owner on Aug 2, 2023. It is now read-only.

Unable to add a breakpoint to a file containing an & in path name #948

Closed
DonJayamanne opened this issue Oct 22, 2018 · 3 comments
Closed
Assignees
Labels
Milestone

Comments

@DonJayamanne
Copy link
Contributor

Environment data

  • PTVSD version: Release
  • OS and version: Windows, Powershell
  • Python version (& distribution if applicable, e.g. Anaconda): N/A
  • Using VS Code or Visual Studio:VSC

Actual behavior

Debugger throws an error with Unable to open .... file not found error.

Expected behavior

Debugger should support & in path.

Steps to reproduce:

  1. Use Powershell as the shell in VSC
  2. Create a folder with an &
  3. Create a python file in that folder
  4. Start debugging with a breakpoint in that file

Originally reported microsoft/vscode-python#2620

@karthiknadig
Copy link
Member

@DonJayamanne do you have the error stack by chance?

@karthiknadig
Copy link
Member

Looking at the stack info that we receive from pydevd:

<xml>
    <thread id="pid_5276_id_2217585763272">
        <frame id="2217603071240" name="&lt;module&gt;" file="C%3A%5CGIT%5Cpyscratch2%5Ctest%26amp%3Bmytest%5Cmytest.py" line="1"></frame>
        <frame id="2217595381496" name="_run" file="C%3A%5CGIT%5Cptvsd%5Cptvsd%5C_local.py" line="140"></frame>
        <frame id="2217602507328" name="run_file" file="C%3A%5CGIT%5Cptvsd%5Cptvsd%5C_local.py" line="79"></frame>
        <frame id="2217601072432" name="debug_main" file="C%3A%5CGIT%5Cptvsd%5Cptvsd%5C_local.py" line="45"></frame>
        <frame id="2217601071960" name="handle_args" file="C%3A%5CGIT%5Cptvsd%5Cptvsd%5C__main__.py" line="220"></frame>
        <frame id="2217549471256" name="main" file="C%3A%5CGIT%5Cptvsd%5Cptvsd%5C__main__.py" line="227"></frame>
        <frame id="2217551981048" name="&lt;module&gt;" file="C%3A%5CUsers%5Ckanadig%5C.vscode%5Cextensions%5Cms-python.python-2018.10.0-alpha%5CpythonFiles%5Cexperimental%5Cptvsd_launcher.py" line="38"></frame>
    </thread>
</xml>

The folder name gets escaped xml escaped and url escaped. test%26amp%3Bmytest. Since we unquote after untangle has processed the xml we don't get the correct path back.

@karthiknadig
Copy link
Member

[Option 1] is to xml unescape after we unquote in wrapper.py
[Option 2] One option is to add &; to quote in pydevd_comm.py: https://github.com/Microsoft/ptvsd/blob/fcdb060b76d2648ae8788e4ac8e5097c4fbf24ec/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py#L820

@karthiknadig karthiknadig added this to the Nov 2018.2 milestone Nov 6, 2018
@karthiknadig karthiknadig self-assigned this Nov 8, 2018
karthiknadig added a commit that referenced this issue Nov 8, 2018
* Fix 948. Stacktrace contains xml escaped characters.

* Test for paht containing ampersand
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants