Repository navigation
Return EBADF for negative stat file descriptors - #9008
Draft
youknowdot wants to merge 3 commits into
Draft
youknowdot wants to merge 3 commits into
youknowdot wants to merge 3 commits into
Conversation
Return EBADF for negative ordinary descriptors before calling rustix, avoiding debug-build assertions on canonical invalid-fd tests. Keep directory-fd sentinel and absolute-path handling unchanged. Assisted-by: Codex:model-version-unavailable
Exercise ordinary negative descriptors including values accepted by rustix as directory sentinels, without changing canonical tests or directory-fd parsing. Assisted-by: Codex:model-version-unavailable
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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. Comment |
youknowone
reviewed
Oct 8, 2026
Member
There was a problem hiding this comment.
do not add python test code in rust file
Preserve the original Unix RustPython-only coverage and every regression assertion while removing the redundant Rust interpreter wrapper. CPython uses -1 as a path sentinel, so keep this regression scoped to its original runtime. Assisted-by: Codex:model-version-unavailable
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
Extract the negative-descriptor
fstatguard from #8954 for the Python 3.14 main branch.os.stat(-5)andos.fstat(-5)can reach rustix with an invalid ordinary descriptor and panic in debug builds. ReturnEBADFat the shared non-Windowsfstatboundary before calling rustix. Add an interpreter regression covering several negative values, including numbers used as directory-descriptor sentinels elsewhere.This is a four-line implementation change plus one new Rust integration test. Directory-fd parsing and canonical Python tests are unchanged. It is independent of the closerange/termination fixes in #9006.
Validation
Fresh main-based validation on Linux, with source/runtime identity checked:
EBADFfor the tested negative descriptors and preserve valid/closed-fd behavior and six existing supported directory-fd cases.test_osfstat selection also passed throughcargo run.The initial broader
FileTestsrun aborts in the separatetest_closerangecase. The same case aborts on unpatched main; #9006 addresses it. That failed result is retained, and the successful selection excludes that case without changing tests or adding skips. Full localtest_osremains unrun because its asyncio setup requires the sandbox-denied AF_UNIX socketpair. Hosted tests remain enabled; cross-platform CI is pending.The runtime is main's Python 3.14.alpha. Any CPython comparison used the available 3.15.0rc3 interpreter, not a CPython 3.14 build.
AI assistance
Codex assisted with implementation, extraction, source review, regression tests, and automated validation. The original implementation authorship and
Assisted-bytrailer are preserved; the regression commit also includes its disclosure.