Skip to content

馃悰 fix(config): keep the leading pair of a win32 UNC path - #4060

Open
MohammedAlkindi wants to merge 4 commits into
tox-dev:mainfrom
MohammedAlkindi:fix/win32-unc-path-backslash
Open

馃悰 fix(config): keep the leading pair of a win32 UNC path#4060
MohammedAlkindi wants to merge 4 commits into
tox-dev:mainfrom
MohammedAlkindi:fix/win32-unc-path-backslash

Conversation

@MohammedAlkindi

Copy link
Copy Markdown
Contributor

_win32_process_path_backslash collapses any run of exactly two backslashes, treating it as the POSIX-escaped form of one literal backslash. That is right in the middle of a path, but a UNC or extended-length prefix needs both leading backslashes, so a network path in commands silently loses one.

With commands = xcopy \\server\share\file.txt . on main:

$ tox config -e py -k commands
[testenv:py]
commands = xcopy \server\share\file.txt .

\\server becomes \server. No error, and the command runs against a path that does not exist.

The fix keeps a backslash pair literal only when it starts a word and is followed by more path text. A bare trailing \\ is not a prefix and still collapses, which is what WACKY_SLASH_ARGS covers; an earlier attempt that preserved every leading pair broke three of those cases.

Three cases added, failing first (assert ['\\srv\\share'] == ['\\\\srv\\share']). After: tox config reports the path intact, and tests/config/loader/test_str_convert.py is 175 passed, 5 skipped with nothing else changing status. ruff check and ruff format --check clean.

Windows-only path, so it does not show up on Linux CI. Found by inspection, not a user report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant