Resolve package root in inspect.member() before containment checks #2
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from brcly/TuxBox. Originally posted by Batushn on 2026-11-23T20:05:08Z.
Summary
root = Path(root).resolve()at the start ofproject_tuxbox.inspect.member().tests/test_inspect.pyverifying unresolved/relative package roots work in bothmember()andmanifest()while symlinks escaping the package directory are still rejected.Why
member()resolved each matched path (folder = matches[0].resolve()) and checkedfolder.is_relative_to(root), without resolvingrootfirst. Callers passing an unresolved path tomember()ormanifest()? such as a relative directory, a path with.., a symlinked/junctioned package directory, or a Windows 8.3 short temp path ? hit a falseValueError: Package member leaves the package directory.Verification
python -m unittest tests/test_inspect.py tests/test_package_binaries.py -von Windows (Python 3.12.10): 13 tests, all non-skipped tests pass (test_case_collisionskipped on case-insensitive FS).member(Path("."), "README.md")previously raisedValueErrorand now resolves cleanly.(Disclosure: assisted by an AI coding agent; all changes were reviewed and verified locally.)