Skip to content

Conversation

@SaathwikDasari
Copy link

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.

@github-actions
Copy link

GNU testsuite comparison:

GNU test failed: tests/tty/tty-eof. tests/tty/tty-eof is passing on 'main'. Maybe you have to rebase?

@SaathwikDasari
Copy link
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:

  1. The Style/format failure was a network timeout during the 'Set up job' phase (fetching the toolchain).

  2. The tty-eof failure appears to be a known flaky test unrelated to the changes in pr.rs.

This PR is ready for review.

@sylvestre
Copy link
Contributor

please add a test to cover this change

new_ucmd!()
.arg("/dev/null")
.succeeds();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
}

@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pr: /dev/zero: unknown filetype

2 participants