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

Handle alternate NT path forms #2495

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

klightspeed
Copy link

Summary

Description

convert_dos_path does not currently handle UNC paths or paths of the form \??\X: (as returned by Wine). This results in the psutil/tests/test_process.py::TestProcess::test_exe test failing in the following cases:

  • Python is run from a network share; or
  • The tests are performed under Wine on a drive other than the one Python is installed on.

Add handling for the following NT path forms:

  • \\server\share
  • \Device\Mup\server\share -> \\server\share
  • \??\UNC\server\share -> \\server\share
  • \??\X: -> X:

Copy link
Owner

@giampaolo giampaolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please write some tests for this. You can put in test_windows.py, TestSystemAPIs class.

psutil/_pswindows.py Outdated Show resolved Hide resolved
`convert_dos_path` does not currently handle UNC paths or paths of the form `\??\X:` (as returned by Wine).
This results in the `psutil/tests/test_process.py::TestProcess::test_exe` test failing in the following cases:
* Python is run from a network share; or
* The tests are performed under Wine on a drive other than the one Python is installed on.

Add handling for the following NT path forms:
* `\\server\share`
* `\Device\Mup\server\share` -> `\\server\share`
* `\??\UNC\server\share` -> `\\server\share`
* `\??\X:` -> `X:`

Signed-off-by: Ben Peddell <[email protected]>
@klightspeed klightspeed force-pushed the convert_dos_path-handle-nt-path branch from b38f747 to 305bb78 Compare January 3, 2025 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Windows] Alternate NT drive paths not handled in convert_dos_path
2 participants