pr: allow character, block, and fifo devices as input#9946
Merged
sylvestre merged 6 commits intouutils:mainfrom Jan 1, 2026
Merged
pr: allow character, block, and fifo devices as input#9946sylvestre merged 6 commits intouutils:mainfrom
sylvestre merged 6 commits intouutils:mainfrom
Conversation
|
GNU testsuite comparison: |
Contributor
Author
|
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. |
Contributor
|
please add a test to cover this change |
sylvestre
reviewed
Dec 31, 2025
tests/by-util/test_pr.rs
Outdated
| new_ucmd!() | ||
| .arg("/dev/null") | ||
| .succeeds(); | ||
| } No newline at end of file |
|
GNU testsuite comparison: |
Contributor
Author
|
All tests are passing and the output matches GNU behavior. Ready for review! @sylvestre |
sgmarz
pushed a commit
to sgmarz/coreutils
that referenced
this pull request
Jan 7, 2026
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 #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.