-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
pr: allow character, block, and fifo devices as input #9946
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
GNU testsuite comparison: |
|
All core logic is complete and I have verified the fix for /dev/zero locally. I have also addressed the unused-mut warning for Windows to ensure cross-platform compatibility. Regarding the remaining CI failures:
This PR is ready for review. |
|
please add a test to cover this change |
tests/by-util/test_pr.rs
Outdated
| new_ucmd!() | ||
| .arg("/dev/null") | ||
| .succeeds(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| } | |
| } | |
|
GNU testsuite comparison: |
Fixes #9935
Problem: Running pr on character devices (e.g., /dev/zero) or FIFOs triggers an unknown filetype error because the check was limited to regular files and symlinks.
Solution: Updated the match logic in src/uu/pr/src/pr.rs to accept is_char_device(), is_block_device(), and is_fifo() as valid inputs, matching GNU pr behavior.
Testing:
Manual: cargo run --bin coreutils -- pr /dev/zero now reads the stream instead of erroring.
cargo test --package uu_pr passed.
Style: Ran cargo fmt.