fuzz: replace unsafe libc::dup by rustix::io::dup#12148
Open
blixygetir wants to merge 15 commits intouutils:mainfrom
Open
fuzz: replace unsafe libc::dup by rustix::io::dup#12148blixygetir wants to merge 15 commits intouutils:mainfrom
blixygetir wants to merge 15 commits intouutils:mainfrom
Conversation
for more information, see https://pre-commit.ci
This comment was marked as resolved.
This comment was marked as resolved.
There was a problem hiding this comment.
Pull request overview
This PR updates the uufuzz harness to avoid unsafe libc::dup by switching to the safe rustix::io::dup wrapper, adjusting fd handling accordingly.
Changes:
- Replace
libc::dupcalls withrustix::io::dupinfuzz/uufuzz/src/lib.rsand adjust error handling/ownership transfer. - Add
rustixas a dependency foruufuzz(and updatefuzz/Cargo.lock). - Add a
fuzz/rust-toolchain.tomlsetting the fuzz workspace toolchain to nightly.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| fuzz/uufuzz/src/lib.rs | Switch stdout/stderr/stdin duplication from libc::dup to rustix::io::dup and refactor fd handling. |
| fuzz/uufuzz/Cargo.toml | Add rustix dependency needed for rustix::io::dup. |
| fuzz/rust-toolchain.toml | Introduce a nightly toolchain pin for the fuzz workspace. |
| fuzz/Cargo.lock | Lockfile update to include rustix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
GNU testsuite comparison: |
This comment was marked as resolved.
This comment was marked as resolved.
0e02b4f to
417d0a5
Compare
Removes the unnecessary nightly toolchain requirement that was causing CI failures. All code uses only stable Rust features. This fixes clippy component availability issues on all platforms.
4a61ce4 to
5d00293
Compare
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
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.
Fixes #12110
Replaces unsafe libc::dup calls with the safe rustix::io::dup wrapper in fuzz/uufuzz/src/lib.rs. The code now uses Result instead of checking for -1, and leverages IntoRawFd to transfer ownership to raw i32 file descriptors, allowing them to be used throughout the function without auto-closing.