Skip to content

fix(sources): catch FileNotFoundError for broken symlinks#1087

Merged
mergify[bot] merged 1 commit intopython-wheel-build:mainfrom
andre-motta:fix/scan-compiled-extensions-broken-symlinks
Apr 23, 2026
Merged

fix(sources): catch FileNotFoundError for broken symlinks#1087
mergify[bot] merged 1 commit intopython-wheel-build:mainfrom
andre-motta:fix/scan-compiled-extensions-broken-symlinks

Conversation

@andre-motta
Copy link
Copy Markdown
Contributor

Closes: #1082

Pull Request Description

What

Add FileNotFoundError to the except clause in scan_compiled_extensions and add a regression test.

Why

Broken symlinks (e.g. .dockerignore → missing .gitignore in PyTorch tarballs) crash the bootstrap with FileNotFoundError since 0.80.0.

@andre-motta andre-motta requested a review from a team as a code owner April 23, 2026 12:12
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 23, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b9764f50-df48-4b8a-bd93-999c48aed831

📥 Commits

Reviewing files that changed from the base of the PR and between 172b371 and 9589c5b.

📒 Files selected for processing (2)
  • src/fromager/sources.py
  • tests/test_sources.py
✅ Files skipped from review due to trivial changes (2)
  • tests/test_sources.py
  • src/fromager/sources.py

📝 Walkthrough

Walkthrough

The PR updates scan_compiled_extensions to catch FileNotFoundError in addition to IsADirectoryError when opening files, so broken symlinks are skipped instead of raising. An accompanying unit test adds a broken-symlink scenario and verifies the function returns no matches rather than raising an error.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: catching FileNotFoundError for broken symlinks in the sources module.
Description check ✅ Passed The description is directly related to the changeset, explaining what was added (FileNotFoundError handling and regression test) and why (broken symlinks cause crashes).
Linked Issues check ✅ Passed The PR fully addresses the requirements from #1082: it catches FileNotFoundError in scan_compiled_extensions and adds a regression test for broken symlinks.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the broken symlink handling issue; no unrelated modifications are present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mergify mergify Bot added the ci label Apr 23, 2026
@LalatenduMohanty
Copy link
Copy Markdown
Member

@mergify rebase

Add FileNotFoundError to except clause and add test for broken symlinks.

Closes: python-wheel-build#1082
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Andre Lustosa <alustosa@redhat.com>
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Apr 23, 2026

Deprecation notice: This pull request comes from a fork and was rebased using bot_account impersonation. This capability will be removed on July 1, 2026. After this date, the rebase action will no longer be able to rebase fork pull requests with this configuration. Please switch to the update action/command to ensure compatibility going forward.

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Apr 23, 2026

rebase

✅ Branch has been successfully rebased

@LalatenduMohanty LalatenduMohanty force-pushed the fix/scan-compiled-extensions-broken-symlinks branch from 172b371 to 9589c5b Compare April 23, 2026 12:30
@mergify mergify Bot merged commit ae65fdb into python-wheel-build:main Apr 23, 2026
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

scan_compiled_extensions crashes on broken symlinks since 0.80.0

3 participants