Skip to content

Conversation

@HandSonic
Copy link
Contributor

Original issue: #1949

Added test for pull #2613

The function in question assumes that ROOT is a prefix of full_path, and tries to remove it. However, it is not necessarily a prefix:

  • when ROOT is determined, both os.path.abspath() and os.path.realpath() gets called
  • when full_path is determined, only os.path.abspath() is called

This means that if the path contains a symlink, it will show up as resolved in ROOT, but not full_path, so simply removing the first X characters of full_path is not sufficient.

This PR adds an assertion to catch the bad situation early, then adds the os.path.realpath call to full_path.

  • ran the linter to address style issues (tox -e fix)
  • wrote descriptive pull request text
  • ensured there are test(s) validating the fix
  • added news fragment in docs/changelog folder
  • updated/extended the documentation

@HandSonic HandSonic marked this pull request as ready for review May 11, 2024 09:22
@HandSonic HandSonic requested a review from gaborbernat May 11, 2024 17:12
@gaborbernat gaborbernat enabled auto-merge (squash) May 11, 2024 17:16
@gaborbernat gaborbernat merged commit 0a3816e into pypa:main May 11, 2024
@HandSonic HandSonic deleted the Fix-#1949 branch May 12, 2024 12:06
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.

2 participants