Skip to content

fix(filesystem): strip the NT path prefix from info-mode link targets - #517

Open
jaeminbird wants to merge 1 commit into
CursorTouch:mainfrom
jaeminbird:fix-info-link-prefix
Open

jaeminbird wants to merge 1 commit into
CursorTouch:mainfrom
jaeminbird:fix-info-link-prefix

Conversation

@jaeminbird

Copy link
Copy Markdown
Contributor

Follow-up to #514. test_symlink_info_reports_link fails on main (Python 3.14). The runner can create symlinks, so the test runs there. It is skipped on machines without that privilege.

>       assert f"Link target: {target}" in result
E       AssertionError: assert 'Link target: C:\\Users\\runneradmin\\...\\target.txt' in 'Path: ...'

Cause: for absolute targets, os.readlink returns the \\?\C:\... form, so info mode printed Link target: \\?\C:\.... That was a real output bug, not only a test problem. The junction test passed only because it checked str(target) in result, which matches without the prefix.

Fix: strip \\?\ (and turn \\?\UNC\ into \\) before showing the target. The junction test now checks the exact Link target: line.

Validation: the junction test (which runs without privileges) fails before the fix and passes after. I also checked the symlink path with os.readlink mocked to return the CI value. Full suite: 1355 passed, 8 skipped. ruff check is clean on the changed files.

os.readlink returns absolute symlink and junction targets as
\\?\C:\..., so info mode showed the NT path form. Strip the prefix
(\\?\UNC\ becomes \\) and make the junction test match the exact
target.
@jaeminbird jaeminbird changed the title fix(filesystem): drop the \?\ prefix from info-mode link targets fix(filesystem): strip the NT path prefix from info-mode link targets Oct 29, 2026

This branch has not been deployed

No deployments
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.

1 participant