Skip in-tree directory links so sdist keeps the real package - #2388
Open
Kayforkind wants to merge 3 commits into
Open
Skip in-tree directory links so sdist keeps the real package#2388Kayforkind wants to merge 3 commits into
Kayforkind wants to merge 3 commits into
Conversation
A junction or symlink that sorts before its target was marking the target inode as seen, which dropped packages from sdists.
cjames23
requested changes
Aug 18, 2026
| identifier = stat.st_dev, stat.st_ino | ||
| # An in-tree directory symlink/junction that sorts before its target | ||
| # would otherwise mark the target inode as seen and skip the real | ||
| # directory (issues #1197, #2008). Skip the alias so the real path is |
Member
There was a problem hiding this comment.
Do not include issue links or reference numbers in comments. And comments should explain things that are not clearly explainable by reading the code itself.
Comment on lines
+172
to
+173
| https://github.com/pypa/hatch/issues/1197 | ||
| https://github.com/pypa/hatch/issues/2008 |
Member
There was a problem hiding this comment.
Remove issue links from comments
Review asked that comments explain only the inode first-seen-wins trap, without ticket links.
Author
|
@cjames23 thanks for the master sync. Comment cleanup in �ackend/src/hatchling/builders/utils.py and ests/backend/builders/plugin/test_interface.py is in ef34209 — issue links dropped, comment kept to the inode first-seen-wins trap that isn't obvious from the code. CI is green on the merged HEAD. Ready when you are for another look. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
safe_walkfollows directory links and records(st_dev, st_ino)to stop cycles. A junction or symlink whose name sorts before its target (bar→foo) was markingfoo's inode as already seen, so the real package was never walked.excludeof the alias no longer drops the real package's files.Fixes #1197.
Fixes #2008.
Test plan
test_in_tree_dir_link_does_not_hide_real_directory(issue Junctions/symbolic links can cause directories to be missing from source distributions #1197 repro)test_excluding_dir_link_keeps_real_directory(Inconsistent/surprising symlink handling during sdist build? #2008 exclude footgun)hatch test tests/backend/builders→ 469 passed, 10 skippedtest_infinite_loop_preventionstill valid (unix)AI disclosure
Assisted by Cursor. I directed the change, reviewed inode first-seen-wins vs cycle detection, and verified the tests above. No
Co-authored-byLLM trailer.Made with Cursor