Skip to content

🐛 fix(py-info): detect equivalent base prefixes - #219

Merged
gaborbernat merged 2 commits into
tox-dev:mainfrom
gaborbernat:bug/cjz08kpy-prefix-cycle
Nov 3, 2026
Merged

gaborbernat merged 2 commits into
tox-dev:mainfrom
gaborbernat:bug/cjz08kpy-prefix-cycle

Conversation

@gaborbernat

@gaborbernat gaborbernat commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

When a queried interpreter reported its base directory with a different ../ spelling on each query, resolve_to_system() treated every spelling as a new prefix and kept probing the same candidate. The walk now detects the repeated directory and finishes resolution. Fixes #190.

Equivalent prefix spellings

The old cycle check stored the reported prefix string. Python's realpath() resolves parent segments and links, while normcase() folds case and slash spelling on Windows. The new cycle key uses those forms; discovery still receives the reported prefix.

Behavior changes

A candidate that reports its own base directory through equivalent paths resolves after one base probe. A cycle through distinct directories still raises RuntimeError.

Reported by Anthropic's OSS Scanner: ANT-2026-CJZ08KPY.

A candidate can report the same base directory with changing path
spellings and evade the prefix cycle check. Compare canonical paths
while keeping the reported path for interpreter discovery.
@gaborbernat gaborbernat added the bug Something isn't working label Nov 3, 2026
@gaborbernat
gaborbernat merged commit 7322c9c into tox-dev:main Nov 3, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Changing prefix spellings can loop during base resolution

1 participant